Add schema validation in IDE for route map definition files

This commit is contained in:
2026-03-01 20:05:55 +00:00
parent bda2e8a0be
commit e70b55a5f0
4 changed files with 618 additions and 10 deletions

View File

@@ -1,6 +1,6 @@
routeStart: Reading
routeEnd: Bristol TM
routeId: 0002
routeId: "0002"
updated: 2026-02-04
checked:
signallerStart: TVSC Reading WS

View File

@@ -1,8 +1,9 @@
# yaml-language-server: $schema=./mapFiles.schema.json
routeStart: Gloucester
routeEnd: Severn Tunnel Jn
routeId: 2421
routeId: "2421"
updated: 2026-02-28
checked:
checked: 2026-03-01
signallerStart: Gloucester PSB
signallerEnd: SWCC Severn Tunnel WS
elecStart:
@@ -51,6 +52,7 @@ routeDetail:
- type: minorBridge
name: St. Catherines Meadow Viaduct
category: minorRoad
position: under
miles: 115
chains: 2
@@ -64,6 +66,7 @@ routeDetail:
- type: minorBridge
name: Ham Meadow Viaduct
category: minorRoad
position: under
miles: 115
chains: 20
@@ -77,6 +80,7 @@ routeDetail:
chains: 32
- type: minorBridge
category: minorRoad
position: under
miles: 115
chains: 37
@@ -106,6 +110,7 @@ routeDetail:
chains: 48
- type: minorBridge
category: minorRoad
position: under
miles: 116
chains: 40
@@ -117,6 +122,7 @@ routeDetail:
chains: 46
- type: minorBridge
category: minorRoad
position: under
miles: 116
chains: 64
@@ -148,6 +154,7 @@ routeDetail:
chains: 48
- type: minorBridge
category: minorRoad
name: Farm Bridge
position: over
miles: 118
@@ -185,7 +192,7 @@ routeDetail:
chains: 1
- type: crossing
kind: cctv
kind: CCTV
name: Ley Level Crossing
description: CCTV by Gloucester
miles: 120
@@ -198,13 +205,14 @@ routeDetail:
chains: 49
- type: crossing
kind: R/G
kind: r/g
name: Broken Cross Farm Level Crossing
miles: 120
chains: 66
- type: minorBridge
position: over
category: minorRoad
name: Grange Court Road
miles: 121
chains: 50
@@ -244,18 +252,20 @@ routeDetail:
- type: minorBridge
name: Farm Bridge
category: minorRoad
position: under
miles: 123
chains: 33
- type: minorBridge
name: Cattle Creep
category: minorRoad
position: under
miles: 123
chains: 53
- type: crossing
kind: OMSL
kind: omsl
name: Broadoak Crossing
miles: 123
chains: 76
@@ -270,6 +280,7 @@ routeDetail:
- type: minorBridge
name: Cattle Creep
category: minorRoad
position: under
miles: 124
chains: 25
@@ -283,6 +294,7 @@ routeDetail:
- type: minorBridge
name: Cattle Creep
category: minorRoad
position: under
miles: 124
chains: 45
@@ -297,6 +309,8 @@ routeDetail:
- type: signallerChange
from: Gloucester PSB (G)
to: SWCC Severn Tunnel Workstation (NT)
miles: 125
chains: 10
- type: tunnel
tunnelType: whole
@@ -307,6 +321,7 @@ routeDetail:
- type: minorBridge
name: Farm Bridge
category: minorRoad
position: over
miles: 125
chains: 26
@@ -340,12 +355,14 @@ routeDetail:
- type: minorBridge
name: Farm Bridge
category: minorRoad
position: over
miles: 126
chains: 74
- type: minorBridge
name: Awre Road Cockshoot Bridge
category: minorRoad
position: over
miles: 127
chains: 34
@@ -396,6 +413,7 @@ routeDetail:
- type: minorBridge
name: Cliff Farm Bridge
category: minorRoad
position: over
miles: 131
chains: 79
@@ -458,6 +476,7 @@ routeDetail:
- type: minorBridge
name: Garlands Bridge
category: minorRoad
position: under
miles: 134
chains: 26
@@ -505,13 +524,14 @@ routeDetail:
chains: 77
- type: crossing
kind: R/G
kind: r/g
name: Woolaston Level Crossing
miles: 136
chains: 14
- type: minorBridge
name: Farm Bridge
category: minorRoad
position: over
miles: 136
chains: 27
@@ -531,6 +551,7 @@ routeDetail:
- type: minorBridge
name: Farm Bridge
category: minorRoad
position: under
miles: 139
chains: 56
@@ -599,7 +620,7 @@ routeDetail:
chains: 15
- type: crossing
kind: OMSL
kind: omsl
name: Three Gates Crossing
miles: 143
chains: 35
@@ -612,12 +633,13 @@ routeDetail:
- type: minorBridge
name: Redcliffe Bridge
category: minorRoad
position: over
miles: 144
chains: 40
- type: crossing
kind: OMSL
kind: omsl
name: Mathern 21 Foot Crossing
miles: 144
chains: 68
@@ -643,13 +665,14 @@ routeDetail:
- type: minorBridge
name: Portskewett Road
category: minorRoad
position: over
miles: 146
chains: 32
- type: crossing
name: Caldicot Level Crossing
kind: cctv
kind: CCTV
description: CCTV by SWCC
miles: 147
chains: 4
@@ -689,6 +712,7 @@ routeDetail:
- type: minorBridge
name: Ifton Tramway Underbridge
category: minorRoad
position: under
miles: 148
chains: 50

View 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
}
}
}