Add schema validation in IDE for route map definition files
This commit is contained in:
576
static/mapFiles/yaml/mapFiles.schema.json
Normal file
576
static/mapFiles/yaml/mapFiles.schema.json
Normal file
@@ -0,0 +1,576 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft-07/schema#",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"routeStart",
|
||||
"routeEnd",
|
||||
"routeId",
|
||||
"updated",
|
||||
"signallerStart",
|
||||
"signallerEnd",
|
||||
"elecStart",
|
||||
"elecEnd",
|
||||
"routeDetail"
|
||||
],
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"routeStart": {
|
||||
"type": "string",
|
||||
"description": "The route start point"
|
||||
},
|
||||
"routeEnd": {
|
||||
"type": "string",
|
||||
"description": "The route end point"
|
||||
},
|
||||
"routeId": {
|
||||
"type": "string",
|
||||
"description": "The routes ID Code",
|
||||
"pattern": "^[0-9]{4}$"
|
||||
},
|
||||
"updated": {
|
||||
"type": "string",
|
||||
"format": "date",
|
||||
"description": "Date the route was last updated"
|
||||
},
|
||||
"checked": {
|
||||
"type": "string",
|
||||
"format": "date",
|
||||
"description": "Date the route was last checked for accuracy"
|
||||
},
|
||||
"signallerStart": {
|
||||
"type": "string",
|
||||
"description": "The signaller at the start of the route"
|
||||
},
|
||||
"signallerEnd": {
|
||||
"type": "string",
|
||||
"description": "The signalller at the end of the route"
|
||||
},
|
||||
"elecStart": {
|
||||
"$ref": "#/definitions/elecInfo",
|
||||
"description": "Electrification details at the route start"
|
||||
},
|
||||
"elecEnd": {
|
||||
"$ref": "#/definitions/elecInfo",
|
||||
"description": "Electrification info at the end of the route"
|
||||
},
|
||||
"routeDetail": {
|
||||
"type": "array",
|
||||
"additionalItems": false,
|
||||
"items": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/bridge"
|
||||
},
|
||||
{
|
||||
"$ref": "#/definitions/crossing"
|
||||
},
|
||||
{
|
||||
"$ref": "#/definitions/crossover"
|
||||
},
|
||||
{
|
||||
"$ref": "#/definitions/electrificationChange"
|
||||
},
|
||||
{
|
||||
"$ref": "#/definitions/junction"
|
||||
},
|
||||
{
|
||||
"$ref": "#/definitions/loop"
|
||||
},
|
||||
{
|
||||
"$ref": "#/definitions/routeContinuation"
|
||||
},
|
||||
{
|
||||
"$ref": "#/definitions/siteof"
|
||||
},
|
||||
{
|
||||
"$ref": "#/definitions/station"
|
||||
},
|
||||
{
|
||||
"$ref": "#/definitions/tunnel"
|
||||
},
|
||||
{
|
||||
"$ref": "#/definitions/signallerChange"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"elecInfo": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"elec": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"25kvac",
|
||||
"750vdc",
|
||||
"650vdc",
|
||||
"1500vdc",
|
||||
"none"
|
||||
]
|
||||
},
|
||||
"eco": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"elec"
|
||||
]
|
||||
},
|
||||
"bridge": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"type": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"bridge",
|
||||
"minorBridge"
|
||||
]
|
||||
},
|
||||
"roadName": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
"position": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"over",
|
||||
"under"
|
||||
]
|
||||
},
|
||||
"category": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"road",
|
||||
"aroad",
|
||||
"motorway",
|
||||
"foot",
|
||||
"waterway",
|
||||
"stream",
|
||||
"rail",
|
||||
"minorRoad",
|
||||
"pipeline"
|
||||
]
|
||||
},
|
||||
"miles": {
|
||||
"type": "number"
|
||||
},
|
||||
"chains": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"type",
|
||||
"position",
|
||||
"category",
|
||||
"miles",
|
||||
"chains"
|
||||
],
|
||||
"additionalProperties": false
|
||||
},
|
||||
"crossing": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"type": {
|
||||
"type": "string",
|
||||
"const": "crossing"
|
||||
},
|
||||
"kind": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"CCTV",
|
||||
"AHB",
|
||||
"uwc",
|
||||
"foot",
|
||||
"omsl",
|
||||
"r/g",
|
||||
"msl",
|
||||
"mcb",
|
||||
"mg",
|
||||
"mcg",
|
||||
"aocl"
|
||||
]
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
"miles": {
|
||||
"type": "number"
|
||||
},
|
||||
"chains": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"type",
|
||||
"kind",
|
||||
"name",
|
||||
"miles",
|
||||
"chains"
|
||||
],
|
||||
"additionalProperties": false
|
||||
},
|
||||
"crossover": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"type": {
|
||||
"type": "string",
|
||||
"const": "crossovers"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
"miles": {
|
||||
"type": "number"
|
||||
},
|
||||
"chains": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"type",
|
||||
"name",
|
||||
"miles",
|
||||
"chains"
|
||||
],
|
||||
"additionalProperties": false
|
||||
},
|
||||
"electrificationChange": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"type": {
|
||||
"type": "string",
|
||||
"const": "electrificationChange"
|
||||
},
|
||||
"miles": {
|
||||
"type": "number"
|
||||
},
|
||||
"chains": {
|
||||
"type": "number"
|
||||
},
|
||||
"from": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"elec": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"25kvac",
|
||||
"750vdc",
|
||||
"650vdc",
|
||||
"1500vdc",
|
||||
"none"
|
||||
]
|
||||
},
|
||||
"eco": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"elec"
|
||||
],
|
||||
"additionalProperties": false
|
||||
},
|
||||
"to": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"elec": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"25kvac",
|
||||
"750vdc",
|
||||
"650vdc",
|
||||
"1500vdc",
|
||||
"none"
|
||||
]
|
||||
},
|
||||
"eco": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"elec"
|
||||
],
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"miles",
|
||||
"chains"
|
||||
],
|
||||
"additionalProperties": false
|
||||
},
|
||||
"junction": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"type": {
|
||||
"type": "string",
|
||||
"const": "junction"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
"diverges": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"left",
|
||||
"right",
|
||||
"both"
|
||||
]
|
||||
},
|
||||
"direction": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"up",
|
||||
"down",
|
||||
"both"
|
||||
]
|
||||
},
|
||||
"miles": {
|
||||
"type": "number"
|
||||
},
|
||||
"chains": {
|
||||
"type": "number"
|
||||
},
|
||||
"elecBranch": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"25kvac",
|
||||
"750vdc",
|
||||
"650vdc",
|
||||
"1500vdc",
|
||||
"none"
|
||||
]
|
||||
},
|
||||
"goto": {
|
||||
"type": "string"
|
||||
},
|
||||
"entryPoint": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"name",
|
||||
"diverges",
|
||||
"direction",
|
||||
"miles",
|
||||
"chains",
|
||||
"type"
|
||||
],
|
||||
"additionalProperties": false
|
||||
},
|
||||
"loop": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"type": {
|
||||
"type": "string",
|
||||
"const": "loop"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
"position": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"left",
|
||||
"right",
|
||||
"both"
|
||||
]
|
||||
},
|
||||
"miles": {
|
||||
"type": "number"
|
||||
},
|
||||
"chains": {
|
||||
"type": "number"
|
||||
},
|
||||
"loopElec": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"25kvac",
|
||||
"750vdc",
|
||||
"650vdc",
|
||||
"1500vdc",
|
||||
"none"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"type",
|
||||
"name",
|
||||
"position",
|
||||
"miles",
|
||||
"chains"
|
||||
],
|
||||
"additionalProperties": false
|
||||
},
|
||||
"routeContinuation": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"type": {
|
||||
"type": "string",
|
||||
"const": "continues"
|
||||
},
|
||||
"routeName": {
|
||||
"type": "string",
|
||||
"description": "Name to display"
|
||||
},
|
||||
"routeId": {
|
||||
"type": "string",
|
||||
"description": "Id of route"
|
||||
},
|
||||
"entryPoint": {
|
||||
"type": "string",
|
||||
"description": "Entrypoint of other route (lowercase, replacing whitespace with -, junction always referred to as jn"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"type",
|
||||
"routeName",
|
||||
"routeId",
|
||||
"entryPoint"
|
||||
],
|
||||
"additionalProperties": false
|
||||
},
|
||||
"siteof": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"type": {
|
||||
"type": "string",
|
||||
"const": "siteof"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
"miles": {
|
||||
"type": "number"
|
||||
},
|
||||
"chains": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"type",
|
||||
"name",
|
||||
"miles",
|
||||
"chains"
|
||||
],
|
||||
"additionalProperties": false
|
||||
},
|
||||
"station": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"type": {
|
||||
"type": "string",
|
||||
"const": "station"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
"miles": {
|
||||
"type": "number"
|
||||
},
|
||||
"chains": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"type",
|
||||
"name",
|
||||
"miles",
|
||||
"chains"
|
||||
]
|
||||
},
|
||||
"tunnel": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"type": {
|
||||
"type": "string",
|
||||
"const": "tunnel"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
"tunnelType": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"start",
|
||||
"end",
|
||||
"mid",
|
||||
"whole"
|
||||
]
|
||||
},
|
||||
"length": {
|
||||
"type": "string",
|
||||
"pattern": ""
|
||||
},
|
||||
"miles": {
|
||||
"type": "number"
|
||||
},
|
||||
"chains": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"type",
|
||||
"name",
|
||||
"tunnelType",
|
||||
"miles",
|
||||
"chains"
|
||||
],
|
||||
"additionalProperties": false
|
||||
},
|
||||
"signallerChange": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"type": {
|
||||
"type": "string",
|
||||
"const": "signallerChange"
|
||||
},
|
||||
"from": {
|
||||
"type": "string"
|
||||
},
|
||||
"to": {
|
||||
"type": "string"
|
||||
},
|
||||
"miles": {
|
||||
"type": "number"
|
||||
},
|
||||
"chains": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"from",
|
||||
"to",
|
||||
"miles",
|
||||
"chains"
|
||||
],
|
||||
"additionalProperties": false
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user