diff options
author | Phil Sutter <phil@nwl.cc> | 2019-05-27 13:36:41 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2019-05-31 18:17:36 +0200 |
commit | ef2ff133007855707f978f75ac638af3d5c06fbe (patch) | |
tree | 9e270cf8cf1e82499ce1b782eb1307bcb8570637 /py/schema.json | |
parent | 6d0c815e281c4edc539c535491d6425cf0f8edeb (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.json | 16 |
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" ] +} |