speed-dreams-code/doc/download-manager/assets.schema.json
xavi92 afe8b2fa8b Add JSON schema and example for assets lists
The JSON schema provides a machine and human-readable specification of
the assets lists that implementors must follow so that Speed Dreams can
fetch them. An example JSON file has also been provided.

Run check-jsonschema(1) to test an assets JSON file. It can be
downloaded via `pip install check-jsonschema`.


git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@9489 30fe4595-0a0c-4342-8851-515496e4dcbd

Former-commit-id: bff0b86104dfe3e88896e1d5bfcfa35be2008265
Former-commit-id: e830b70b32d944c24515452ebd76f0dfdb0a6860
2024-07-15 03:07:48 +00:00

93 lines
2.6 KiB
JSON

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://example.com/product.schema.json",
"title": "Assets",
"description": "A list of downloadable assets for Speed Dreams",
"type": "object",
"definitions": {
"url": {
"type": "string",
"pattern": "^(http(s)*:\\/\\/)[-a-zA-Z0-9@:%._\\+~#=]{2,256}(\\.[a-z]{2,6})*\\b([-a-zA-Z0-9@:%_\\+.~#?&//=]*)$"
},
"directory": {
"type": "string",
"pattern": "^[aA-zZ|\\-|_|0-9]+$"
},
"number": {
"type": "string",
"pattern": "^\\d+$"
},
"asset": {
"type": "object",
"required": [
"name",
"author",
"category",
"license",
"url",
"hashtype",
"hash",
"size",
"thumbnail",
"directory",
"revision"
],
"properties": {
"name": {
"type": "string"
},
"author": {
"type": "string"
},
"category": {
"$ref": "#/definitions/directory"
},
"url": {
"$ref": "#/definitions/url"
},
"license": {
"type": "string"
},
"hashtype": {
"type": "string",
"enum": [
"sha256"
]
},
"hash": {
"type": "string",
"pattern": "^[aA-fF|0-9]+$"
},
"size": {
"$ref": "#/definitions/number"
},
"thumbnail": {
"$ref": "#/definitions/url"
},
"directory": {
"$ref": "#/definitions/directory"
},
"revision": {
"$ref": "#/definitions/number"
}
}
},
"assets": {
"type": "array",
"items": {
"$ref": "#/definitions/asset"
}
}
},
"properties": {
"cars": {
"$ref": "#/definitions/assets"
},
"tracks": {
"$ref": "#/definitions/assets"
},
"drivers": {
"$ref": "#/definitions/assets"
}
}
}