Skip to content

Conversation

@Mattsface
Copy link
Collaborator

@Mattsface Mattsface commented Jan 13, 2026

What

  • Removed `_transform_keys_in_data()` function from `MlbDataAdapter`
  • Updated model field aliases to match actual API camelCase format (e.g., `homeRun`, `isHomeRun`, `dateTime`, `metaData`)
  • Made optional fields that may be missing in API responses
  • Updated external tests to use camelCase field names
  • Removed all mock tests and JSON fixtures (22,370 lines)

Tests

External tests updated and passing with camelCase field names. Mock tests removed.

Risk and impact

Risk level: Normal

Well-scoped refactoring that removes transformation layer. Pydantic models maintain same Pythonic `snake_case` attribute names via aliases. External tests validate changes work with real API responses.

Impact if something goes wrong:

  • Pydantic validation will catch mismatches early with clear error messages
  • Fix would be straightforward: update field alias to match actual API response key"

…PI responses

Remove the _transform_keys_in_data function from MlbDataAdapter that was
lowercasing all API response keys. Models now directly use the camelCase
field names returned by the MLB Stats API.

Key changes:
- Remove _transform_keys_in_data() function and its usage
- Update model field aliases to match actual API camelCase format:
  * homeRun, tieBreaker, isHomeRun, isTieBreaker (homerunderby)
  * dateTime, timeStamp, metaData (game models)
  * inTieBreaker, tieBreakerNum (homerunderby status)
  * wobaCon (stats)
- Make optional fields that may be missing in API responses:
  * calendar_event_id, start_time_tbd (game models)
  * wildcard_games_back, wildcard_elimination_number (standings)
- Update external tests to use camelCase field names
- Remove all mock tests and associated JSON fixtures (22,370 lines)

This simplifies the codebase by removing an unnecessary transformation
layer and ensures models directly reflect the API's native response format.
@Mattsface Mattsface changed the title Switch models to camelCase API keys refactor: remove key transformation and use native camelCase API responses Jan 14, 2026
@Mattsface Mattsface merged commit 4bf811b into main Jan 14, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants