11 Commits

Author SHA1 Message Date
b8c773c3c9 Add type for departure board data
All checks were successful
Generate and Release Protos / release (push) Successful in 40s
2026-05-06 19:47:33 +01:00
a7fe008fee Ensure required fields exist...
All checks were successful
Generate and Release Protos / release (push) Successful in 37s
2026-05-03 10:20:32 +01:00
6cfc12b538 Remove unused fields from TrainDetails response 2026-05-03 10:20:09 +01:00
53ce528d56 Change type of Cancel Reason & Delay Reason to string, the string will be sent.
All checks were successful
Generate and Release Protos / release (push) Successful in 36s
2026-05-03 10:05:56 +01:00
25c1793df3 Add 'cancelled throughout' field, to highlight in the search results whether a service is completely cancelled
All checks were successful
Generate and Release Protos / release (push) Successful in 38s
2026-05-03 09:34:31 +01:00
48f1a31378 Remove reference to other schema, it seems that I can either configure it for TS or Go generation, but not both.
All checks were successful
Generate and Release Protos / release (push) Successful in 38s
2026-05-03 00:38:48 +01:00
376370c729 Fix incorrect path
Some checks failed
Generate and Release Protos / release (push) Failing after 32s
2026-05-03 00:32:10 +01:00
180886fd68 Adjust script & paths so that referencing other schemas work
Some checks failed
Generate and Release Protos / release (push) Failing after 28s
2026-05-03 00:30:46 +01:00
513196c43d Try and adjust path
Some checks failed
Generate and Release Protos / release (push) Failing after 27s
2026-05-03 00:25:17 +01:00
5d4271c193 Add PIS item to the 'TrainDetails' response
Some checks failed
Generate and Release Protos / release (push) Failing after 34s
2026-05-03 00:21:12 +01:00
c02ff3ebab Adjust how time types are specified
All checks were successful
Generate and Release Protos / release (push) Successful in 40s
2026-05-02 09:14:16 +01:00
4 changed files with 269 additions and 39 deletions

View File

@@ -0,0 +1,232 @@
{
"$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": {
"n": {
"type": "string",
"title": "Location Name",
"description": "The name of the location"
},
"o": {
"type": "string",
"title": "Operator (if station)",
"description": "The operator of the station, if the location is a station"
},
"s": {
"title": "Services",
"type": "array",
"items": {
"$ref": "#/definitions/boardService"
}
},
"m": {
"type": "array",
"title": "messages",
"items": {
"$ref": "#/definitions/boardMsgs"
}
}
},
"required": [
"n"
],
"definitions": {
"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"
}
}
},
"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"
},
"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"
}
}
}
}
}

View File

@@ -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"
} }
} }
} }

View File

@@ -1,12 +1,7 @@
{ {
"$schema": "https://json-schema.org/draft-07/schema#", "$schema": "https://json-schema.org/draft-07/schema#",
"title": "TrainByHeadcodeResponse", "title": "TrainDetailsResponse",
"$defs": { "$defs": {
"DateTimeTZ": {
"type": "string",
"format": "date-time",
"description": "An ISO-8601 timestamp"
},
"ServiceLocation": { "ServiceLocation": {
"type": "object", "type": "object",
"description": "A specific location along the services journey", "description": "A specific location along the services journey",
@@ -67,47 +62,58 @@
"description": "The formation ID at this location" "description": "The formation ID at this location"
}, },
"pta": { "pta": {
"$ref": "#/$defs/DateTimeTZ", "type": "string",
"format": "date-time",
"title": "Public time of arrival" "title": "Public time of arrival"
}, },
"wta": { "wta": {
"$ref": "#/$defs/DateTimeTZ", "type": "string",
"format": "date-time",
"title": "Working time of arrival" "title": "Working time of arrival"
}, },
"wtp": { "wtp": {
"$ref": "#/$defs/DateTimeTZ", "type": "string",
"format": "date-time",
"title": "Working time of pass" "title": "Working time of pass"
}, },
"ptd": { "ptd": {
"$ref": "#/$defs/DateTimeTZ", "type": "string",
"format": "date-time",
"title": "Public time of departure" "title": "Public time of departure"
}, },
"wtd": { "wtd": {
"$ref": "#/$defs/DateTimeTZ", "type": "string",
"format": "date-time",
"title": "Working time of departure" "title": "Working time of departure"
}, },
"eta": { "eta": {
"$ref": "#/$defs/DateTimeTZ", "type": "string",
"format": "date-time",
"title": "Estimated time of arrival" "title": "Estimated time of arrival"
}, },
"etd": { "etd": {
"$ref": "#/$defs/DateTimeTZ", "type": "string",
"format": "date-time",
"title": "Estimated time of departure" "title": "Estimated time of departure"
}, },
"etp": { "etp": {
"$ref": "#/$defs/DateTimeTZ", "type": "string",
"format": "date-time",
"title": "Estimated time of pass" "title": "Estimated time of pass"
}, },
"ata": { "ata": {
"$ref": "#/$defs/DateTimeTZ", "type": "string",
"format": "date-time",
"title": "Actual time of arrival" "title": "Actual time of arrival"
}, },
"atd": { "atd": {
"$ref": "#/$defs/DateTimeTZ", "type": "string",
"format": "date-time",
"title": "Actual time of departure" "title": "Actual time of departure"
}, },
"atp": { "atp": {
"$ref": "#/$defs/DateTimeTZ", "type": "string",
"format": "date-time",
"title": "Actual time of pass" "title": "Actual time of pass"
} }
}, },
@@ -122,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",
@@ -160,7 +149,7 @@
}, },
"cr": { "cr": {
"title": "Cancel Reason", "title": "Cancel Reason",
"type": "integer" "type": "string"
}, },
"cl": { "cl": {
"title": "Cancel Location", "title": "Cancel Location",
@@ -174,7 +163,7 @@
}, },
"dr": { "dr": {
"title": "Delay Reason", "title": "Delay Reason",
"type": "integer" "type": "string"
}, },
"dl": { "dl": {
"title": "Delay Location", "title": "Delay Location",
@@ -202,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",
@@ -210,6 +199,9 @@
"items": { "items": {
"$ref": "#/$defs/ServiceLocation" "$ref": "#/$defs/ServiceLocation"
} }
},
"pis": {
"description": "PIS data for the service (if available)"
} }
} }
} }

View File

@@ -15,10 +15,10 @@ 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"
done done
echo "✅ Generated single TS package in gen/ts" echo "✅ Generated single TS package in gen/ts"