summaryrefslogtreecommitdiffstats
path: root/py/schema.json
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2019-05-27 13:36:41 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2019-05-31 18:17:36 +0200
commitef2ff133007855707f978f75ac638af3d5c06fbe (patch)
tree9e270cf8cf1e82499ce1b782eb1307bcb8570637 /py/schema.json
parent6d0c815e281c4edc539c535491d6425cf0f8edeb (diff)
py: Implement JSON validation in nftables module
Using jsonschema it is possible to validate any JSON input to make sure it formally conforms with libnftables JSON API requirements. Implement a simple validator class for use within a new Nftables class method 'json_validate' and ship a minimal schema definition along with the package. Signed-off-by: Phil Sutter <phil@nwl.cc> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'py/schema.json')
-rw-r--r--py/schema.json16
1 files changed, 16 insertions, 0 deletions
diff --git a/py/schema.json b/py/schema.json
new file mode 100644
index 00000000..460e2156
--- /dev/null
+++ b/py/schema.json
@@ -0,0 +1,16 @@
+{
+ "$schema": "http://json-schema.org/schema#",
+ "description": "libnftables JSON API schema",
+
+ "type": "object",
+ "properties": {
+ "nftables": {
+ "type": "array",
+ "minitems": 0,
+ "items": {
+ "type": "object"
+ }
+ }
+ },
+ "required": [ "nftables" ]
+}