Merge pull request 'download-manager: Make validation file more strict' (#31) from iceflower/speed-dreams-code:main into main
Reviewed-on: #31 Reviewed-by: Xavier Del Campo Romero <xavi@noreply.forge.a-lec.org>
This commit is contained in:
commit
2dcf10d14a
2 changed files with 112 additions and 57 deletions
|
@ -107,8 +107,7 @@ Where:
|
|||
- `karting`
|
||||
- `road`
|
||||
- `speedway`
|
||||
- For drivers, it must be one of the available robots, such as
|
||||
`simplix` or `usr`.
|
||||
- For drivers, it should not match `human` or `networkhuman`.
|
||||
- `author`: defines the author(s) for an asset. Speed Dreams shall not
|
||||
perform any specific actions based on the value of this string.
|
||||
- `license`: defines the license covering the asset. Speed Dreams shall not
|
||||
|
|
|
@ -1,93 +1,149 @@
|
|||
{
|
||||
"$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",
|
||||
"$id": "https://forge.a-lec.org/speed-dreams/speed-dreams-code/raw/branch/main/doc/download-manager/assets.schema.json",
|
||||
"title": "Asset Database",
|
||||
"description": "A list of downloadable assets for Speed Dreams.",
|
||||
"type": "object",
|
||||
"definitions": {
|
||||
"properties": {
|
||||
"cars": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/$defs/car"
|
||||
}
|
||||
},
|
||||
"tracks": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/$defs/track"
|
||||
}
|
||||
},
|
||||
"drivers": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/$defs/driver"
|
||||
}
|
||||
}
|
||||
},
|
||||
"$defs": {
|
||||
"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": {
|
||||
"uint": {
|
||||
"title": "Unsigned integer",
|
||||
"description": "A positive (or zero) integer, expressed as a string.",
|
||||
"type": "string",
|
||||
"pattern": "^\\d+$"
|
||||
},
|
||||
"car": {
|
||||
"$ref": "#/$defs/asset"
|
||||
},
|
||||
"driver": {
|
||||
"$ref": "#/$defs/asset",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"category"
|
||||
],
|
||||
"properties": {
|
||||
"category": {
|
||||
"description": "The category is used to determine the sub directory in which the track is stored.",
|
||||
"type": "string",
|
||||
"not": {
|
||||
"enum": [
|
||||
"human",
|
||||
"networkhuman"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"track": {
|
||||
"$ref": "#/$defs/asset",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"category"
|
||||
],
|
||||
"properties": {
|
||||
"category": {
|
||||
"description": "The category is used to determine the sub directory in which the track is stored.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"circuit",
|
||||
"development",
|
||||
"dirt",
|
||||
"gprix",
|
||||
"karting",
|
||||
"road",
|
||||
"speedway"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"asset": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"author",
|
||||
"category",
|
||||
"license",
|
||||
"url",
|
||||
"hashtype",
|
||||
"directory",
|
||||
"hash",
|
||||
"hashtype",
|
||||
"license",
|
||||
"name",
|
||||
"revision",
|
||||
"size",
|
||||
"thumbnail",
|
||||
"directory",
|
||||
"revision"
|
||||
"url"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"author": {
|
||||
"description": "The author(s).",
|
||||
"type": "string"
|
||||
},
|
||||
"category": {
|
||||
"$ref": "#/definitions/directory"
|
||||
},
|
||||
"url": {
|
||||
"$ref": "#/definitions/url"
|
||||
},
|
||||
"license": {
|
||||
"description": "Which category an asset belongs to.",
|
||||
"type": "string"
|
||||
},
|
||||
"directory": {
|
||||
"description": "The directory name where the asset shall be stored. The exact directory structure will be determined by Speed Dreams. The directory name should be unique for each asset among each category.",
|
||||
"type": "string",
|
||||
"pattern": "^[aA-zZ|\\-|_|0-9]+$"
|
||||
},
|
||||
"hash": {
|
||||
"description": "Resulting hash as calculated by the hash function defined by hashtype.",
|
||||
"type": "string",
|
||||
"pattern": "^[aA-fF|0-9]+$"
|
||||
},
|
||||
"hashtype": {
|
||||
"description": "The hash function used to calculate the hash.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"sha256"
|
||||
]
|
||||
},
|
||||
"hash": {
|
||||
"type": "string",
|
||||
"pattern": "^[aA-fF|0-9]+$"
|
||||
"license": {
|
||||
"description": "The license covering the asset. Speed Dreams shall not perform any specific actions based on the value of this string.",
|
||||
"type": "string"
|
||||
},
|
||||
"size": {
|
||||
"$ref": "#/definitions/number"
|
||||
},
|
||||
"thumbnail": {
|
||||
"$ref": "#/definitions/url"
|
||||
},
|
||||
"directory": {
|
||||
"$ref": "#/definitions/directory"
|
||||
"name": {
|
||||
"description": "Human-readable name for an asset.",
|
||||
"type": "string"
|
||||
},
|
||||
"revision": {
|
||||
"$ref": "#/definitions/number"
|
||||
"description": "The revision of an asset. This value is used as a basic mechanism to inform users about updates.",
|
||||
"$ref": "#/$defs/uint"
|
||||
},
|
||||
"size": {
|
||||
"description": "The size of the asset in bytes.",
|
||||
"$ref": "#/$defs/uint"
|
||||
},
|
||||
"thumbnail": {
|
||||
"description": "The URL to a thumbnail image. The URL must point to an image file with an extension known to the GfTexReadImageFromFile function.",
|
||||
"$ref": "#/$defs/url"
|
||||
},
|
||||
"url": {
|
||||
"description": "The URL to download the asset. The URL must point to a ZIP file.",
|
||||
"$ref": "#/$defs/url"
|
||||
}
|
||||
}
|
||||
},
|
||||
"assets": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/asset"
|
||||
}
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"cars": {
|
||||
"$ref": "#/definitions/assets"
|
||||
},
|
||||
"tracks": {
|
||||
"$ref": "#/definitions/assets"
|
||||
},
|
||||
"drivers": {
|
||||
"$ref": "#/definitions/assets"
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue