-
Couldn't load subscription status.
- Fork 6
feat: operation api OpenAPI sync with Mobility Database Catalog API #1415
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
base: main
Are you sure you want to change the base?
Conversation
| @@ -0,0 +1,110 @@ | |||
| # Mobility Feed API - AI Coding Assistant Instructions | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file adds context to copilot and other AI agents.
| assert result is True | ||
|
|
||
| def test_database_error_handling(self, processor, feed_payload): | ||
| @patch("main.check_url_status") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to add this patch because the test started failing locally; in fact, I'm not sure why it was working in the first place...
Summary:
Fixes #1151
This PR is a significant change in the operations API architecture. As of now, the operations API is an "independent" API with similar behaviour to the public API. This makes it harder to maintain, as most of the converters/transformers(we called them models) were duplicated. Porting functionality to the operations API always implied duplicate efforts. To solve this, we are now copying all the OpenAPI entities from the public API to the operations API. On the implementation side, we are inheriting the models from the public API and adding extra fields and logic. At the OpenAPI level, we keep separate sets of
pathsand' params' to allow having different end-user interfaces while reusing the entities and implementation.Endpoints changes and additions:
/v1/operations/feeds(modified): This endpoint only returns feed general information without any data type. Before, if data_type was provided, it returned general feed information along with data_type-specific information./v1/operations/gtfs_feeds/{id}(new): This endpoint returns GTFS feed information/v1/operations/gtfs_rt_feeds/{id}(new): This endpoint returns GTFS-RT feed informationOpenApi changes
How to keep the public API and the operations API components in sync?
x-operation: truetag. Ideally, it should be marked withx-internal: true, but due to this bug, we can't. Example:./api-operations-update-schema.sh. This script will keep in the OperationsAPI yaml file only the components marked with the x-operations tag and copy all components from the Mobility Database Catalog API.From our AI friend:
This pull request introduces significant refactoring and modernization of the Mobility Feed API codebase, with a focus on replacing legacy generated code (
feeds_operations_gen) with new generated code (feeds_gen), improving error handling, and clarifying project architecture and development workflows. The changes also enhance test reliability and update code references for better maintainability.Project architecture and documentation:
.github/copilot-instructions.md, detailing code generation patterns, critical development commands, error handling, database conventions, and integration points.Code generation and project structure refactor:
feeds_operations_gen) with new generated code (feeds_gen) across the operations API, including imports,.gitignore,.coveragerc, and OpenAPI generator file lists. This unifies the codebase around the new spec-first API implementation. [1] [2] [3] [4]db_modelsfolder for shared models, supporting the new code structure.API implementation and query logic improvements:
feeds_operations_impl.py) to use the new models fromfeeds_gen, replaced the legacy feed processing logic with a unifiedOperationFeedImpl.from_orm, and added new endpoints for fetching individual GTFS and GTFS-RT feeds. [1] [2] [3] [4]Error handling and reliability:
Cleanup and dependency updates:
basic_feed_impl.py) as part of the migration to new models.compare_java_versionsutility to the new location for consistency. [1] [2] [3]pycountryto requirements for enhanced data handling..flake8exclusions to match new generated code folder names.These changes collectively modernize the codebase, improve maintainability, and clarify development practices for current and future contributors.
Expected behavior:
Explain and/or show screenshots for how you expect the pull request to work in your testing (in case other devices exhibit different behavior).
Testing tips:
Provide tips, procedures and sample files on how to test the feature.
Testers are invited to follow the tips AND to try anything they deem relevant outside the bounds of the testing tips.
Please make sure these boxes are checked before submitting your pull request - thanks!
./scripts/api-tests.shto make sure you didn't break anything