Skip to content

Commit

Permalink
test: Create schema for json output format
Browse files Browse the repository at this point in the history
  • Loading branch information
abelcheung committed Dec 16, 2023
1 parent de809ef commit 07c9e83
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 7 deletions.
8 changes: 1 addition & 7 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
83 changes: 83 additions & 0 deletions test/rifiuti-schema.json
Original file line number Diff line number Diff line change
@@ -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"
]
}

0 comments on commit 07c9e83

Please sign in to comment.