-
Notifications
You must be signed in to change notification settings - Fork 34
Closed
Description
Summary
The API currently blocks all queries for future dates (tomorrow and beyond), preventing users from planning trips in advance. This violates expected OneBusAway API behavior where future scheduling is a core feature.
Impact
- ❌ Users cannot query schedules for tomorrow or any future date
- ❌ Trip planning functionality is effectively broken
- ❌ Non-compliant with standard OneBusAway API expectations
Root Cause
File: internal/utils/api.go
Lines: 85-91
Function: ParseTimeParameter
The function contains validation logic that explicitly rejects any date after today's midnight.
Reproduction
# Query for tomorrow's schedule - this will fail
curl "http://localhost:4000/api/where/schedule-for-stop/{id}?key=test&date=2026-02-02"
# Returns 400 error: "Invalid field value for field \"time\"."Proposed Fix
Remove lines 85-91 from internal/utils/api.go that check if parsedTimeMidnight.After(todayMidnight) and return an error.
The function should accept future dates and let the GTFS data availability determine what can be returned.
Test Updates Required
File: internal/utils/api_test.go
- Update the test case named "Future date (should fail)" to expect success instead of failure
- Add a new test case
TestParseTimeParameter_FutureDateto verify future dates are accepted and prevent regression
Verification
make test
go test ./internal/utils -run TestParseTimeParameterReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels