Skip to content

Return station counts as integers - #1555

Merged
frenck merged 1 commit into
mainfrom
frenck/station-count-int
Oct 1, 2026
Merged

frenck merged 1 commit into
mainfrom
frenck/station-count-int

Conversation

@frenck

@frenck frenck commented Oct 1, 2026

Copy link
Copy Markdown
Owner

Breaking change

Country.station_count, Language.station_count and Tag.station_count are now an int instead of a str.

Code that treats the value as a string (for example concatenating it, or comparing it to "0") needs to use it as a number instead. Code that formats it in an f-string keeps working as is. Home Assistant does not use these fields.

Proposed change

The API sends stationcount as a number, but the models declared station_count as a string. mashumaro dutifully converted 6469 into "6469". That made the counts useless for arithmetic, and sorting on them sorted as text ("18" before "6469" before "926").

The models now declare it as an int, matching what the API sends.

Type of change

  • Dependency or tooling upgrade
  • Bugfix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Deprecation (replaces or removes a feature, with a migration path)
  • Breaking change (a fix or feature that changes existing behavior)
  • Code quality, refactor, or test-only change
  • Documentation only

Additional information

  • This PR fixes or closes issue: fixes # None
  • This PR is related to: Add a proper test suite #1553
  • Link to a separate documentation pull request: None

Checklist

  • I fully understand the code in this pull request and can explain every line, including any AI-assisted changes.
  • The change is covered by tests, and poetry run pytest passes locally. A pull request cannot be merged unless CI is green.
  • poetry run prek run --all-files passes (lint, format, and type checks).
  • No commented-out or dead code is left in the pull request.

The API sends stationcount as a number, but Country, Language and Tag
declared station_count as a string, so mashumaro turned 6469 into "6469".
That made the counts useless for arithmetic and sorted them as text.
@frenck frenck added the breaking-change A breaking change for existing users. label Oct 1, 2026
@frenck
frenck merged commit 90fa5d8 into main Oct 1, 2026
31 checks passed
@frenck
frenck deleted the frenck/station-count-int branch October 1, 2026 06:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking-change A breaking change for existing users.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant