feat: support feed stable ids as request parameter in the GBFS validator batch function#1306
Merged
davidgamez merged 2 commits intomainfrom Jul 31, 2025
Merged
feat: support feed stable ids as request parameter in the GBFS validator batch function#1306davidgamez merged 2 commits intomainfrom
davidgamez merged 2 commits intomainfrom
Conversation
cka-y
approved these changes
Jul 31, 2025
Contributor
cka-y
left a comment
There was a problem hiding this comment.
LGTM! Follow up issue for GTFS?
Member
Author
Great idea! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
This pull request enhances the
gbfs_validator_batchfunction to support processing specific feeds based on a POST request with feed stable IDs, improves error handling, and adds corresponding unit tests. The most important changes include modifying the function signature, adding logic to handle feed IDs, introducing a helper function for fetching feeds by ID, and creating a new test case.Enhancements to
gbfs_validator_batchfunction:requestparameter, enabling the function to process POST requests with a JSON body containingfeed_ids. This allows selective feed processing or fallback to processing all feeds if no feed IDs are provided. (functions-python/gbfs_validator/src/main.py, [1] [2]functions-python/gbfs_validator/src/main.py, functions-python/gbfs_validator/src/main.pyL116-R133)New helper function:
fetch_gbfs_feeds_by_stable_idsto query and retrieve GBFS feeds by their IDs, filtering out deprecated feeds. This modularizes the logic for feed retrieval by ID. (functions-python/gbfs_validator/src/main.py, functions-python/gbfs_validator/src/main.pyR169-R178)Unit test additions:
test_gbfs_validator_batch_by_feed_ids, to validate the behavior of thegbfs_validator_batchfunction when processing specific feed IDs. This test ensures proper handling of POST requests, feed retrieval, and publishing logic. (functions-python/gbfs_validator/tests/test_gbfs_validator.py, functions-python/gbfs_validator/tests/test_gbfs_validator.pyR182-R218)Summary generated by our AI friend
Expected behavior:
When the batch function receives the feed_ids field in the post body, it only publishes events for the listed ids; otherwise, it will publish the events for all GBFS ids.
Testing tips:
(Internal team only)Deployed to DEV, this function can be tested by sending the command:
Please make sure these boxes are checked before submitting your pull request - thanks!
./scripts/api-tests.shto make sure you didn't break anything