fix: register missing Situation endpoint route (#798)#804
Open
tejasva-vardhan wants to merge 1 commit intoOneBusAway:mainfrom
Open
fix: register missing Situation endpoint route (#798)#804tejasva-vardhan wants to merge 1 commit intoOneBusAway:mainfrom
tejasva-vardhan wants to merge 1 commit intoOneBusAway:mainfrom
Conversation
Contributor
Author
|
@aaronbrethorst @Ahmedhossamdev would love any review on this! |
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.
Overview
This PR resolves #798 by properly registering the
GET /api/where/situation/{id}route in the REST API. While the handler logic was present, it was not wired to the router, causing a 404/HTML fallback when requesting real-time service alerts.Changes
internal/restapi/routes.go.situationHandlerto correctly fetch and format service alerts usingapi.extractAndValidateID.GetAllAlerts()ininternal/gtfs/realtime.goto provide access to the in-memory GTFS-RT alert store.internal/restapi/situation_handler_test.go(verified withgo test).Verification (Before vs After)
To ensure full parity with the legacy OBA Java API, I verified the fix using both the
maglev-validatorand manual browser testing.1. Maglev Validator Comparison
Local Maglev (
localhost:4000) vs Production Java API (api.pugetsound.onebusaway.org).2. Browser Manual Testing
Endpoint:
/api/where/situation/1_84714.json?key=testNote for Reviewers: - Only core logic files for the fix are included in this PR.
modernc.org/sqlite) and local performance bypasses were intentionally excluded to maintain upstream standards.