Compare commits
9 Commits
v3.0.3-alp
...
v3.0.3-alp
| Author | SHA1 | Date | |
|---|---|---|---|
| 5918cc54a8 | |||
| 3b1a9a2be1 | |||
| b8c773c3c9 | |||
| a7fe008fee | |||
| 6cfc12b538 | |||
| 53ce528d56 | |||
| 25c1793df3 | |||
| 48f1a31378 | |||
| 376370c729 |
266
schemas/api/stations/board.json
Normal file
266
schemas/api/stations/board.json
Normal file
@@ -0,0 +1,266 @@
|
|||||||
|
{
|
||||||
|
"$id": "https://schema.owlboard.info/api/stations/board.schema.json",
|
||||||
|
"$schema": "https://json-schema.org/draft-07/schema#",
|
||||||
|
"title": "StationsBoard",
|
||||||
|
"description": "Arr/Dep/Pass Board",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"d": {
|
||||||
|
"title": "Metadata",
|
||||||
|
"type": "object",
|
||||||
|
"$ref": "#/definitions/metadata"
|
||||||
|
},
|
||||||
|
"s": {
|
||||||
|
"title": "Services",
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/boardService"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"m": {
|
||||||
|
"type": "array",
|
||||||
|
"title": "messages",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/boardMsgs"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"n"
|
||||||
|
],
|
||||||
|
"definitions": {
|
||||||
|
"metadata": {
|
||||||
|
"type": "object",
|
||||||
|
"required": ["n", "o"],
|
||||||
|
"properties": {
|
||||||
|
"n": {
|
||||||
|
"type": "string",
|
||||||
|
"title": "Location Name",
|
||||||
|
"description": "The name of the location"
|
||||||
|
},
|
||||||
|
"o": {
|
||||||
|
"type": "string",
|
||||||
|
"title": "Station Operator",
|
||||||
|
"description": "The operator of the station (not present for location)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"boardService": {
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"r",
|
||||||
|
"o",
|
||||||
|
"ip",
|
||||||
|
"og",
|
||||||
|
"dt"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"r": {
|
||||||
|
"type": "string",
|
||||||
|
"title": "RID",
|
||||||
|
"description": "Services RID"
|
||||||
|
},
|
||||||
|
"o": {
|
||||||
|
"type": "string",
|
||||||
|
"title": "TOC",
|
||||||
|
"description": "The services operator code"
|
||||||
|
},
|
||||||
|
"ip": {
|
||||||
|
"type": "boolean",
|
||||||
|
"title": "isPassenger",
|
||||||
|
"description": "Whether this is a passenger service"
|
||||||
|
},
|
||||||
|
"og": {
|
||||||
|
"type": "object",
|
||||||
|
"title": "Origin",
|
||||||
|
"description": "The services origin",
|
||||||
|
"required": ["t", "n"],
|
||||||
|
"properties": {
|
||||||
|
"t": {
|
||||||
|
"type": "string",
|
||||||
|
"title": "TIPLOC",
|
||||||
|
"description": "The Origin TIPLOC"
|
||||||
|
},
|
||||||
|
"n": {
|
||||||
|
"type": "string",
|
||||||
|
"title": "Name",
|
||||||
|
"description": "The Origin Name"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"dt": {
|
||||||
|
"type": "object",
|
||||||
|
"title": "Destination",
|
||||||
|
"description": "The services destination",
|
||||||
|
"required": ["t", "n"],
|
||||||
|
"properties": {
|
||||||
|
"t": {
|
||||||
|
"type": "string",
|
||||||
|
"title": "TIPLOC",
|
||||||
|
"description": "The Destination TIPLOC"
|
||||||
|
},
|
||||||
|
"n": {
|
||||||
|
"type": "string",
|
||||||
|
"title": "Name",
|
||||||
|
"description": "The Destination Name"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"h": {
|
||||||
|
"type": "string",
|
||||||
|
"title": "Headcode",
|
||||||
|
"description": "The headcode of the service"
|
||||||
|
},
|
||||||
|
"sta": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "date-time",
|
||||||
|
"title": "Scheduled Arrival",
|
||||||
|
"description": "The scheduled arrival time of the service (public or working)"
|
||||||
|
},
|
||||||
|
"ata": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "date-time",
|
||||||
|
"title": "Actual Arrival",
|
||||||
|
"description": "The actual arrival time of the service"
|
||||||
|
},
|
||||||
|
"eta": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "date-time",
|
||||||
|
"title": "Estimated Arrival",
|
||||||
|
"description": "The estimated arrival time of the service"
|
||||||
|
},
|
||||||
|
"std": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "date-time",
|
||||||
|
"title": "Scheduled Departure",
|
||||||
|
"description": "The scheduled departure time of the service (public or working)"
|
||||||
|
},
|
||||||
|
"atd": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "date-time",
|
||||||
|
"title": "Actual Departure",
|
||||||
|
"description": "The actual departure time of the service"
|
||||||
|
},
|
||||||
|
"etd": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "date-time",
|
||||||
|
"title": "Estimated Departure",
|
||||||
|
"description": "The estimated departure time of the service"
|
||||||
|
},
|
||||||
|
"wtp": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "date-time",
|
||||||
|
"title": "Scheduled Pass",
|
||||||
|
"description": "The scheduled pass time of the service"
|
||||||
|
},
|
||||||
|
"atp": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "date-time",
|
||||||
|
"title": "Actual Pass",
|
||||||
|
"description": "The actual pass time of the service"
|
||||||
|
},
|
||||||
|
"etp": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "date-time",
|
||||||
|
"title": "Estimated Pass",
|
||||||
|
"description": "The estimated pass time of the service"
|
||||||
|
},
|
||||||
|
"p": {
|
||||||
|
"type": "string",
|
||||||
|
"title": "Platform",
|
||||||
|
"description": "The platform for this service"
|
||||||
|
},
|
||||||
|
"pc": {
|
||||||
|
"type": "boolean",
|
||||||
|
"title": "Platform Changed",
|
||||||
|
"description": "Whether the platform has changed (alteration)"
|
||||||
|
},
|
||||||
|
"ps": {
|
||||||
|
"type": "boolean",
|
||||||
|
"title": "Platform suppressed",
|
||||||
|
"description": "Whether the platform number is suppressed"
|
||||||
|
},
|
||||||
|
"c": {
|
||||||
|
"type": "boolean",
|
||||||
|
"title": "Cancelled",
|
||||||
|
"description": "Whether the service is cancelled at this location"
|
||||||
|
},
|
||||||
|
"da": {
|
||||||
|
"type": "boolean",
|
||||||
|
"title": "Delayed Arrival",
|
||||||
|
"description": "Whether to show the service as delayed arrival"
|
||||||
|
},
|
||||||
|
"dd": {
|
||||||
|
"type": "boolean",
|
||||||
|
"title": "Delayed Departure",
|
||||||
|
"description": "Whether to show the service as delayed departure"
|
||||||
|
},
|
||||||
|
"cr": {
|
||||||
|
"$ref": "#/definitions/reason"
|
||||||
|
},
|
||||||
|
"dr": {
|
||||||
|
"$ref": "#/definitions/reason"
|
||||||
|
},
|
||||||
|
"act": {
|
||||||
|
"type": "string",
|
||||||
|
"title": "Activities",
|
||||||
|
"description": "Activities at this location"
|
||||||
|
},
|
||||||
|
"f": {
|
||||||
|
"$ref": "#/definitions/formation"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"reason": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"r": {
|
||||||
|
"type": "string",
|
||||||
|
"title": "Reason",
|
||||||
|
"description": "The textual reason"
|
||||||
|
},
|
||||||
|
"l": {
|
||||||
|
"type": "string",
|
||||||
|
"title": "Location",
|
||||||
|
"description": "The location the reason occurred"
|
||||||
|
},
|
||||||
|
"n": {
|
||||||
|
"type": "boolean",
|
||||||
|
"title": "Near",
|
||||||
|
"description": "Whether the reason occured NEAR LOCATION (else AT LOCATION)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"formation": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"fid": {
|
||||||
|
"type": "string",
|
||||||
|
"title": "FID",
|
||||||
|
"description": "The serviced FID at this location"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"boardMsgs": {
|
||||||
|
"type": "object",
|
||||||
|
"required": ["t"],
|
||||||
|
"properties": {
|
||||||
|
"t": {
|
||||||
|
"type": "string",
|
||||||
|
"title": "Text",
|
||||||
|
"description": "The message text"
|
||||||
|
},
|
||||||
|
"l": {
|
||||||
|
"type": "string",
|
||||||
|
"title": "Link",
|
||||||
|
"description": "The NRE Link to the incident page"
|
||||||
|
},
|
||||||
|
"lt": {
|
||||||
|
"type": "string",
|
||||||
|
"title": "Link Text",
|
||||||
|
"description": "The text to display as the link"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -36,6 +36,12 @@
|
|||||||
"description": "The TOC operating the service",
|
"description": "The TOC operating the service",
|
||||||
"minLength": 2,
|
"minLength": 2,
|
||||||
"maxLength": 2
|
"maxLength": 2
|
||||||
|
},
|
||||||
|
"ct": {
|
||||||
|
"type": "boolean",
|
||||||
|
"title": "Cancelled Throughout",
|
||||||
|
"name": "Cancelled Throughout",
|
||||||
|
"description": "Whether the train is cancelled throughout"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -128,23 +128,6 @@
|
|||||||
"type": "object",
|
"type": "object",
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
"properties": {
|
"properties": {
|
||||||
"r": {
|
|
||||||
"type": "string",
|
|
||||||
"title": "RID",
|
|
||||||
"description": "The RID of the service",
|
|
||||||
"maxLength": 16
|
|
||||||
},
|
|
||||||
"u": {
|
|
||||||
"title": "UID",
|
|
||||||
"description": "The UID of the service",
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"s": {
|
|
||||||
"title": "SSD",
|
|
||||||
"description": "The SSD of the service",
|
|
||||||
"type": "string",
|
|
||||||
"format": "date"
|
|
||||||
},
|
|
||||||
"h": {
|
"h": {
|
||||||
"title": "train_id",
|
"title": "train_id",
|
||||||
"description": "Headcode",
|
"description": "Headcode",
|
||||||
@@ -166,7 +149,7 @@
|
|||||||
},
|
},
|
||||||
"cr": {
|
"cr": {
|
||||||
"title": "Cancel Reason",
|
"title": "Cancel Reason",
|
||||||
"type": "integer"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"cl": {
|
"cl": {
|
||||||
"title": "Cancel Location",
|
"title": "Cancel Location",
|
||||||
@@ -180,7 +163,7 @@
|
|||||||
},
|
},
|
||||||
"dr": {
|
"dr": {
|
||||||
"title": "Delay Reason",
|
"title": "Delay Reason",
|
||||||
"type": "integer"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"dl": {
|
"dl": {
|
||||||
"title": "Delay Location",
|
"title": "Delay Location",
|
||||||
@@ -208,7 +191,7 @@
|
|||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": ["r", "s", "h", "t", "ip", "ic"]
|
"required": ["h", "t", "ip", "ic"]
|
||||||
},
|
},
|
||||||
"locations": {
|
"locations": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
@@ -218,7 +201,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"pis": {
|
"pis": {
|
||||||
"$ref": "./schemas/api/pis-object.json"
|
"description": "PIS data for the service (if available)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -15,7 +15,7 @@ for file in $FILES; do
|
|||||||
clean_name=$(echo "${file#schemas/}" | sed 's/\//_/g' | sed 's/\.json//g')
|
clean_name=$(echo "${file#schemas/}" | sed 's/\//_/g' | sed 's/\.json//g')
|
||||||
|
|
||||||
# OGenerate TS
|
# OGenerate TS
|
||||||
npx --yes json-schema-to-typescript "$file" > "../../../gen/ts/${clean_name}.ts"
|
npx --yes json-schema-to-typescript "$file" > "./gen/ts/${clean_name}.ts"
|
||||||
|
|
||||||
# Generate Go
|
# Generate Go
|
||||||
go-jsonschema -p contracts "$file" > "./gen/go/models/${clean_name}.go"
|
go-jsonschema -p contracts "$file" > "./gen/go/models/${clean_name}.go"
|
||||||
|
|||||||
Reference in New Issue
Block a user