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

fix: UI OpenApi generator fails to create a proper Feed's discriminator #555

Merged
merged 13 commits into from
Jul 16, 2024

Conversation

davidgamez
Copy link
Member

@davidgamez davidgamez commented Jul 10, 2024

Summary:

Fixes: #560
The TS types are included as part of the repository. We are using the generate:api-types library to generate the types. Until now, it was at the developers' discretion to run the generator. A breaking change was introduced in a previous PR, and it was not until last week we realized that the TS types were broken when trying to generate the new version. The breaking changes were necessary because the Python fastApi generator, used on the server side, doesn't fully support the anyOf or oneOf OpenApi feature.

Changes:

  • Replace allOf by a schema component containing all properties from BasicFeed, GtfsFeed and GtfsRTFeed.
  • Add a discriminator to the BasicFeed to support TS code generation.
  • Added a Github action for PRs that changed the OpenApi schema if the TS script generator was executed and it contains the expected types, example failing action

Testing tips:

  • Execute the smoke test on the UI, ensuring the Home, Feeds, and Feed pages render the correct information.
  • Start the API locally and verify that the search endpoint returns the same JSON structure as before(QA).

Please make sure these boxes are checked before submitting your pull request - thanks!

  • Run the unit tests with ./scripts/api-tests.sh to make sure you didn't break anything
  • Add or update any needed documentation to the repo
  • Format the title like "feat: [new feature short description]". Title must follow the Conventional Commit Specification(https://www.conventionalcommits.org/en/v1.0.0/).
  • Linked all relevant issues
  • Include screenshot(s) showing how this pull request works and fixes the issue(s)

Copy link

Preview Firebase Hosting URL: https://mobility-feeds-dev--pr-555-hsjgn6ov.web.app

@davidgamez davidgamez marked this pull request as ready for review July 15, 2024 22:54
@davidgamez davidgamez changed the title add feed discriminator to the basicfeed openapi component fix: UI OpenApi generator fails to create a proper Feed's discriminator Jul 15, 2024
docs/DatabaseCatalogAPI.yaml Outdated Show resolved Hide resolved
@indraneel
Copy link
Collaborator

Looks good to me, thank you for this fix @davidgamez

@davidgamez davidgamez merged commit 19c9f71 into main Jul 16, 2024
7 checks passed
@davidgamez davidgamez deleted the fix/feed_discriminator branch July 16, 2024 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UI OpenApi generator fails to create a proper Feed's discriminator
3 participants