4 Commits

Author SHA1 Message Date
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
2 changed files with 28 additions and 19 deletions

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"
} }
}, },
@@ -210,6 +216,9 @@
"items": { "items": {
"$ref": "#/$defs/ServiceLocation" "$ref": "#/$defs/ServiceLocation"
} }
},
"pis": {
"$ref": "./schemas/api/pis-object.json"
} }
} }
} }

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"