Skip to content

Commit 01308b8

Browse files
committed
generate Provider schemas into the root
Existing endpoints are being augmented with Docked information and new endpoints will co-exist.
1 parent 5aa71cc commit 01308b8

7 files changed

Lines changed: 14 additions & 13 deletions

File tree

provider/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ In addition to the standard [Provider payload wrapper](#response-format), respon
413413
[decimal-degrees]: https://en.wikipedia.org/wiki/Decimal_degrees
414414
[dgps]: https://en.wikipedia.org/wiki/Differential_GPS
415415
[events]: #events
416-
[events-schema]: dockless/events.json
416+
[events-schema]: events.json
417417
[event-times]: #event-times
418418
[gbfs]: https://github.com/NABSA/gbfs
419419
[general-information]: /general-information.md
@@ -430,17 +430,17 @@ In addition to the standard [Provider payload wrapper](#response-format), respon
430430
[propulsion-types]: /general-information.md#propulsion-types
431431
[responses]: /general-information.md#responses
432432
[status]: #status-changes
433-
[status-schema]: dockless/status_changes.json
433+
[status-schema]: status_changes.json
434434
[stops]: #stops
435435
[st-intersects]: https://postgis.net/docs/ST_Intersects.html
436436
[toc]: #table-of-contents
437437
[trips]: #trips
438-
[trips-schema]: dockless/trips.json
438+
[trips-schema]: trips.json
439439
[ts]: /general-information.md#timestamps
440440
[vehicles]: #vehicles
441441
[vehicle-types]: /general-information.md#vehicle-types
442442
[vehicle-states]: /general-information.md#vehicle-states
443443
[vehicle-events]: /general-information.md#vehicle-state-events
444-
[vehicles-schema]: dockless/vehicles.json
444+
[vehicles-schema]: vehicles.json
445445
[versioning]: /general-information.md#versioning
446446
[wgs84]: https://en.wikipedia.org/wiki/World_Geodetic_System
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"$id": "https://raw.githubusercontent.com/openmobilityfoundation/mobility-data-specification/main/provider/dockless/events.json",
2+
"$id": "https://raw.githubusercontent.com/openmobilityfoundation/mobility-data-specification/main/provider/events.json",
33
"$schema": "http://json-schema.org/draft-06/schema#",
44
"title": "Schema for MDS Provider events payloads",
55
"type": "object",
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"$id": "https://raw.githubusercontent.com/openmobilityfoundation/mobility-data-specification/main/provider/dockless/status_changes.json",
2+
"$id": "https://raw.githubusercontent.com/openmobilityfoundation/mobility-data-specification/main/provider/status_changes.json",
33
"$schema": "http://json-schema.org/draft-06/schema#",
44
"title": "Schema for MDS Provider status_changes payloads",
55
"type": "object",
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"$id": "https://raw.githubusercontent.com/openmobilityfoundation/mobility-data-specification/main/provider/dockless/trips.json",
2+
"$id": "https://raw.githubusercontent.com/openmobilityfoundation/mobility-data-specification/main/provider/trips.json",
33
"$schema": "http://json-schema.org/draft-06/schema#",
44
"title": "Schema for MDS Provider trips payloads",
55
"type": "object",
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"$id": "https://raw.githubusercontent.com/openmobilityfoundation/mobility-data-specification/main/provider/dockless/vehicles.json",
2+
"$id": "https://raw.githubusercontent.com/openmobilityfoundation/mobility-data-specification/main/provider/vehicles.json",
33
"$schema": "http://json-schema.org/draft-06/schema#",
44
"title": "Schema for MDS Provider vehicles payloads",
55
"type": "object",

schema/generate_schemas.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -465,28 +465,29 @@ def write_provider_schemas(common_definitions):
465465
Create each of the Provider endpoint schema files in the appropriate directory.
466466
"""
467467
print("\nStarting to generate Provider JSON Schemas...\n")
468+
directory = "../provider"
468469

469470
# /trips
470471
trips = provider_trips_schema(common_definitions)
471-
with open("../provider/dockless/trips.json", "w") as schemafile:
472+
with open(f"{directory}/trips.json", "w") as schemafile:
472473
schemafile.write(json.dumps(trips, indent=2))
473474
print("Wrote trips.json")
474475

475476
# /status_changes
476477
status_changes = provider_status_changes_schema(common_definitions)
477-
with open("../provider/dockless/status_changes.json", "w") as schemafile:
478+
with open(f"{directory}/status_changes.json", "w") as schemafile:
478479
schemafile.write(json.dumps(status_changes, indent=2))
479480
print("Wrote status_changes.json")
480481

481482
# /events
482483
events = provider_events_schema(common_definitions)
483-
with open("../provider/dockless/events.json", "w") as schemafile:
484+
with open(f"{directory}/events.json", "w") as schemafile:
484485
schemafile.write(json.dumps(events, indent=2))
485486
print("Wrote events.json")
486487

487488
# /vehicles
488489
vehicles = provider_vehicles_schema(common_definitions)
489-
with open("../provider/dockless/vehicles.json", "w") as schemafile:
490+
with open(f"{directory}/vehicles.json", "w") as schemafile:
490491
schemafile.write(json.dumps(vehicles, indent=2))
491492
print("Wrote vehicles.json")
492493

schema/templates/provider/endpoint.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"$id": "https://raw.githubusercontent.com/openmobilityfoundation/mobility-data-specification/main/provider/dockless/endpoint.json",
2+
"$id": "https://raw.githubusercontent.com/openmobilityfoundation/mobility-data-specification/main/provider/endpoint.json",
33
"$schema": "http://json-schema.org/draft-06/schema#",
44
"title": "Schema for MDS Provider endpoint payloads",
55
"type": "object",

0 commit comments

Comments
 (0)