From ef2ff133007855707f978f75ac638af3d5c06fbe Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Mon, 27 May 2019 13:36:41 +0200 Subject: 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 Signed-off-by: Pablo Neira Ayuso --- py/schema.json | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 py/schema.json (limited to 'py/schema.json') 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" ] +} -- cgit v1.2.3