Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reconciled JSON schemas #534

Merged
merged 10 commits into from
Jun 29, 2020
Merged

Reconciled JSON schemas #534

merged 10 commits into from
Jun 29, 2020

Conversation

thekaveman
Copy link
Collaborator

Following up with #506, this is an update to the JSON Schema generation process and schemas for the reconciled state machine.

Work is ongoing and almost there. Marking as DRAFT for now.

Fixes #518
Fixes #526
Fixes #531

This is a refactor of the Provider schema templates and generation
process to make more reuse of common types and structures:

* The repeated structure from outside wrapper has been refactored into
  templates/provider/endpoint.json

* Common vehicle information (provider_id, vehicle_type, etc.) has been
  refactored into a defintion in templates/common.json, which is added
  to the list of definitions for each endpoint

* Each endpoint specific template has been refactored to contain only
  those properties and definitions specific to the endpoint; common
  properties and definitions are merged at generation time

* The generation script was improved for readability and runtime feedback

* The generation script accepts arguments for selectively generating
  Agency and/or Provider schemas (default is still to generate both)
* reuse common string definition in Agency templates

* renaming vehicle fields in Agency to make common schema reuse easier

* renaming status_changes.associated_trip --> status_changes.trip_id
  and reusing validation rule in Agency and Provider schemas

* pluralizing propulsion_types (array field) in both

* further reorganize schema generation for alignment between Agency and
  Provider
* use new field names and plurality
* common state and event defintions merged by schema generator
* valid state/event combinations merged by schema generator
Existing endpoints are being augmented with Docked information
and new endpoints will co-exist.
Ensure that the vehicle_events array contains
at least one of the valid transition events
for the given vehicle_state
@thekaveman thekaveman marked this pull request as ready for review June 29, 2020 22:09
@thekaveman thekaveman requested a review from a team June 29, 2020 22:09
@thekaveman thekaveman requested a review from a team as a code owner June 29, 2020 22:09
@thekaveman thekaveman requested a review from a team June 29, 2020 22:09
@thekaveman
Copy link
Collaborator Author

See my comment on the Issue for a trade-off I had to make in validating the vehicle state machine.

Copy link
Member

@schnuerle schnuerle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a big job, thanks for taking it on @thekaveman! We appreciate the expertise.

@schnuerle schnuerle merged commit cfee5bf into dev Jun 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Agency Specific to the Agency API Provider Specific to the Provider API Schema Implications for JSON Schema or OpenAPI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reconcile more Agency and Provider fields Add 'other' option to vehicle_type
2 participants