Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
JSON-schema
{
"$schema": "./drivers.schema.json",
"series": "f1",
"season": 2018,
"driverList": [
{
"raceNumber": 14,
"code": "ALO",
"firstName": "Fernando",
"lastName": "Alonso",
"dateOfBirth": "1981-07-29",
"team": "MCLAREN",
"quotes": ["GP2 engine, GP2", "5 second penalty? Issa yoke"]
},
{
"raceNumber": 3,
"code": "RIC",
"firstName": "Daniel",
"lastName": "Ricciardo",
"dateOfBirth": "1989-07-01",
"nationality": "Australian",
"team": "REDBULL"
}
]
}
{
"$schema": "http://json-schema.org/draft-07/schema",
"title": "Drivers",
"description": "Formula 1 drivers",
"type": "object",
"additionalProperties": false,
"properties": {
"$schema": {
"type": "string",
"description": "path to the JSON-schema to use for this file"
},
"series": {
"type": "string",
"const": "f1"
},
"season": {
"type": "integer",
"description": "year corresponding with season"
},
"driverList": {
"type": "array",
"items": {
"$ref": "#/definitions/driver"
}
}
},
"definitions": {
"driver": {
"type": "object",
"additionalProperties": false,
"properties": {
"raceNumber": {
"type": "integer",
"minimum": 0,
"maximum": 99,
"description": "number this driver races with"
},
"code": {
"type": "string",
"minLength": 3,
"maxLength": 3,
"description": "3 letter abbreviation"
},
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"dateOfBirth": {
"type": "string",
"format": "date",
"description": "dateOfBirth in YYYY-MM-DD format",
"default": "YYYY-MM-DD"
},
"nationality": {
"type": "string"
},
"team": {
"$ref": "#/definitions/team"
},
"quotes": {
"type": "array",
"items": {
"type": "string"
},
"uniqueItems": true
}
},
"required": ["raceNumber", "code", "team"]
},
"team": {
"enum": [
"MCLAREN",
"FERRARI",
"REDBULL",
"TOROROSSO",
"MERCEDES",
"RENAULT",
"HAAS",
"FORCEINDIA",
"SAUBER",
"WILLIAMS"
]
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.