Skip to content

fix: remove undocumented fields from trip-details stopTimes schema#1072

Open
3rabiii wants to merge 1 commit into
OneBusAway:mainfrom
3rabiii:fix-trip-details_issue_5
Open

fix: remove undocumented fields from trip-details stopTimes schema#1072
3rabiii wants to merge 1 commit into
OneBusAway:mainfrom
3rabiii:fix-trip-details_issue_5

Conversation

@3rabiii

@3rabiii 3rabiii commented Jun 14, 2026

Copy link
Copy Markdown
Collaborator

Description

This PR addresses by removing extra fields from the trip-details response that were not defined in the wiki spec, reducing payload noise and strictly adhering to the API contract.

Changes Included:

  • Cleaned StopTime Model: Removed DropOffType and PickupType from the base StopTime struct in internal/models/stop_times.go to match the trip-details spec.
  • Preserved Block Endpoint Contract: Since the block endpoint does require these fields in its spec, I introduced a new BlockStopTimeData struct in internal/models/block.go. This wrapper embeds the clean StopTime and appends the necessary drop-off/pickup types.
  • Handler Updates: Updated block_handler.go to construct the response using the new BlockStopTimeData wrapper, isolating the schemas without duplicating core logic.
  • Test Updates: Cleaned up stop_times_test.go to reflect the removed fields.

Fixes: #1057

Summary by CodeRabbit

Release Notes

  • Refactor
    • Reorganized internal data model for block stop timing information to improve code structure and better separate scheduling attributes related to pickup and drop-off operations.

@coderabbitai

coderabbitai Bot commented Jun 14, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

dropOffType and pickupType are removed from StopTime and relocated into a new BlockStopTimeData struct that wraps StopTime. BlockStopTime gains BlockSequence and DistanceAlongBlock fields and changes its StopTime field type to BlockStopTimeData. The block handler and StopTime test are updated accordingly.

Changes

BlockStopTime data model refactor

Layer / File(s) Summary
StopTime and BlockStopTime struct changes
internal/models/stop_times.go, internal/models/block.go
DropOffType and PickupType removed from StopTime; BlockStopTime gains BlockSequence int and DistanceAlongBlock float64 and changes its StopTime field type from StopTime to the new BlockStopTimeData; BlockStopTimeData embeds StopTime and adds DropOffType and PickupType.
Block handler construction and StopTime test update
internal/restapi/block_handler.go, internal/models/stop_times_test.go
transformBlockToEntry nests ArrivalTime, DepartureTime, and StopID inside models.StopTime{} within models.BlockStopTimeData{}, with DropOffType and PickupType set alongside. TestStopTimeJSON removes those two field initializations from the StopTime literal.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related issues

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically summarizes the main change: removing undocumented fields (DropOffType and PickupType) from the StopTime schema to achieve API compliance.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sonarqubecloud

Copy link
Copy Markdown

@3rabiii 3rabiii requested a review from burma-shave June 14, 2026 22:31
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.

trip-details: stopTimes contains extra fields dropOffType and pickupType not in spec

1 participant