Skip to content

feat(directory)!: make omittable directory and index members optional - #392

Merged
benbenbang merged 2 commits into
mainfrom
feat/368-diridx-nullable
Sep 30, 2026
Merged

benbenbang merged 2 commits into
mainfrom
feat/368-diridx-nullable

Conversation

@benbenbang

Copy link
Copy Markdown
Member

FMP can omit several members from its directory and index responses, but the models previously required them, forcing consumers to interpret placeholder values as absence. This change types those members as optional so callers observe absence directly.

  • Make AvailableExchange.country_code and delay, FinancialStatementSymbol.reporting_currency, and HistoricalIndexConstituent.added_security and reason optional across the Rust models, Python bindings and stubs, and the Go SDK.
  • Decode blank typed codes (countryCode, reportingCurrency, removedTicker) to None/nil, while delay, added_security, and reason accept null but preserve an empty string.
  • Keep these members required on the wire so a missing key is still rejected; only null or blank maps to absence.
  • Add Rust, Python, and Go parity tests covering null and empty decoding, wire round-trips, and the still-required missing-member path.
  • Update the Dow Jones fixture to carry a null reason and adjust existing assertions to unwrap the new optional members.

BREAKING CHANGE: AvailableExchange, FinancialStatementSymbol and HistoricalIndexConstituent members FMP can omit are now optional, and "" on their typed codes decodes as None (Option / pointer / Optional); handle None.

AvailableExchange, FinancialStatementSymbol, and HistoricalIndexConstituent
now type the members FMP can omit as optional, and a blank value on a typed
code decodes as absent so consumers observe absence directly.

**Response model changes:**
* `AvailableExchange.country_code` and `delay`, `FinancialStatementSymbol.reporting_currency`, and `HistoricalIndexConstituent.added_security` and `reason` are now optional across the Rust models, the Python bindings and stubs, and the Go SDK.
* Blank typed codes (`countryCode`, `reportingCurrency`, `removedTicker`) now decode to `None`/`nil`, while `delay`, `added_security`, and `reason` accept null but preserve an empty string.
* A missing member is still rejected: these members remain required on the wire and only null or blank maps to absence.

**Test and fixture changes:**
* Added Rust, Python, and Go parity tests covering null and empty decoding, wire round-trips, and the still-required missing-member path.
* Updated the Dow Jones fixture to carry a null `reason` and adjusted existing assertions to unwrap the new optional members.

BREAKING CHANGE: AvailableExchange, FinancialStatementSymbol and HistoricalIndexConstituent members FMP can omit are now optional, and "" on their typed codes decodes as None (Option / pointer / Optional); handle None.
Extend the directory parity tests to verify that AvailableExchange
members omitted by FMP decode null and empty typed codes as nil while
the key itself stays required. Update the accompanying comments to
describe the omittable-member decoding path more accurately.
@benbenbang
benbenbang enabled auto-merge (rebase) September 30, 2026 13:36
@github-actions github-actions Bot added the enhancement New feature or request label Sep 30, 2026
@benbenbang
benbenbang merged commit 85ce80a into main Sep 30, 2026
9 checks passed
@benbenbang
benbenbang deleted the feat/368-diridx-nullable branch September 30, 2026 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant