From 07c9e8327ece5a0bba34bc919d331e9a3b1d850b Mon Sep 17 00:00:00 2001 From: Abel Cheung Date: Sat, 16 Dec 2023 11:34:18 +0000 Subject: [PATCH] test: Create schema for json output format --- .editorconfig | 8 +--- test/rifiuti-schema.json | 83 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+), 7 deletions(-) create mode 100644 test/rifiuti-schema.json diff --git a/.editorconfig b/.editorconfig index 7cf2d65..74b98f9 100644 --- a/.editorconfig +++ b/.editorconfig @@ -9,11 +9,5 @@ indent_style = space [*.{c,h,txt,cmake}] indent_size = 4 -[configure.ac] -indent_size = 4 - -[*.{md,yml}] +[*.{md,yml,json}] indent_size = 2 - -[{Makefile.am,*.mk}] -indent_style = tab diff --git a/test/rifiuti-schema.json b/test/rifiuti-schema.json new file mode 100644 index 0000000..b309517 --- /dev/null +++ b/test/rifiuti-schema.json @@ -0,0 +1,83 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://raw.githubusercontent.com/abelcheung/rifiuti2/0.8.1/test/rifiuti-schema.json", + "title": "rifiuti", + "description": "JSON schema for rifiuti json formatted output", + "type": "object", + "definitions": { + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + } + }, + "properties": { + "format": { + "description": "Recycle bin format", + "type": "string" + }, + "version": { + "allOf": [ + { "$ref": "#/definitions/nonNegativeInteger" }, + { "description": "Version embedded in index file header" } + ] + }, + "ever_existed": { + "allOf": [ + { "$ref": "#/definitions/nonNegativeInteger" }, + { "description": "Total items ever existed in recycle bin" } + ] + }, + "path": { + "description": "Location of recycle bin", + "type": "string" + }, + "records": { + "description": "All recycle bin records", + "type": "array", + "uniqueItems": true, + "minItems": 0, + "items": { + "type": "object", + "properties": { + "index": { + "anyOf": [ + { "$ref": "#/definitions/nonNegativeInteger" }, + { "type": "string" } + ] + }, + "time": { + "type": "string" + }, + "gone": { + "anyOf": [ + { "type": "boolean" }, + { "type": "null" } + ] + }, + "size": { + "anyOf": [ + { "$ref": "#/definitions/nonNegativeInteger" }, + { "type": "null" } + ] + }, + "path": { + "type": "string" + } + }, + "required": [ + "index", + "time", + "gone", + "size", + "path" + ] + } + } + }, + "required": [ + "format", + "version", + "path", + "records" + ] +}