Repository navigation
feat(responses): make omittable FMP response members optional across SDKs - #394
Merged
Merged
Conversation
…onal members optional Members that FMP can send as null are now optional so decoding no longer fails on absent values. Consumers must handle None for these members. **Optional member changes:** * `NewsArticle.image` and `NewsArticle.site` are now optional. * `ExchangeHoliday.is_closed` is now optional. * `EsgDisclosure.company_name` and `EsgDisclosure.form_type` are now optional. * `EsgRating.company_name` is now optional. * `CongressionalMemberProfile.image` is now optional. **Decode behaviour:** * These members are still required to be present, but a null value decodes to None/nil rather than raising a decode error. * The Rust responses use `required_option` deserializers; the Go SDK uses `jsontext.Value` shadows that reject missing members and map null to nil. **Bindings and tests:** * Updated the Python `.pyi` stubs and pyo3 models to expose the optional types, and adjusted the typecheck contract. * Added Rust, Python, and Go parity tests covering null-decodes-to-none while a missing member still fails. BREAKING CHANGE: NewsArticle, ExchangeHoliday, EsgDisclosure, EsgRating and CongressionalMemberProfile members FMP can omit are now optional (Option / pointer / Optional); handle None.
The provider can omit `icoDate`, `circulatingSupply`, and `totalSupply` from a cryptocurrency listing, so these members are now optional across the SDKs instead of required non-null values. **Rust wire model:** * `CryptocurrencyListing` in `crates/libfmp` now types `ico_date`, `circulating_supply`, and `total_supply` as `Option`, keeping the members required but nullable and decoding an empty `icoDate` to `None` via `empty_or_null_date`. * Supply members serialize through `integral_f64::serialize_option` so integral values still round-trip as integers. **Python bindings:** * The `CryptocurrencyListing` model and its stubs expose the three members as `Option` / `typing.Optional`, mapping the inner date only when present. **Go SDK:** * `CryptocurrencyListing` holds pointer members and decodes null or empty values to `nil` through a `jsontext.Value` shadow, while still rejecting missing members. **Tests:** * Added coverage in all three SDKs for null supplies and empty ICO dates decoding to `None` / `nil`, and updated existing assertions to the optional representation. BREAKING CHANGE: CryptocurrencyListing members FMP can omit are now optional (Option / pointer / Optional); handle None.
…ptional Members that FMP can send as null on older filings are now decoded as optional instead of required, so callers must handle the absent case. **Model changes:** * `CrowdfundingOffering` makes `issuerWebsite`, `intermediaryCompanyName`, `intermediaryCommissionFileNumber`, `compensationAmount`, `financialInterest`, `securityOfferedType`, `overSubscriptionAllocationType`, and `offeringDeadlineDate` optional. * `RegulationDOffering` makes `revenueRange` and `securitiesOfferedAreOfEquityType` optional. * `SecCompanyProfile` makes `fiscalYearEnd` and `employees` optional. * `SecCompanySearchResult` makes `phoneNumber` optional. **Decoding behaviour:** * libfmp uses `required_option` so these members must be present but decode a JSON null to `None`; the Go SDK mirrors this with `jsontext.Value` shadows that reject a missing member and map null to nil. * The Python `.pyi` stubs and pyo3 models expose the new `Optional` types, and the typecheck contract now treats `offering_deadline_date` as nullable. **Tests:** * Added libfmp, Go parity, and Python tests asserting each new nullable member decodes null to None/nil while a missing member still fails. BREAKING CHANGE: CrowdfundingOffering, RegulationDOffering, SecCompanyProfile and SecCompanySearchResult members FMP can omit are now optional (Option / pointer / Optional); handle None.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
FMP can send null for a number of response members, which previously caused decode failures because those members were required and non-null. This change makes every such member optional across the Rust, Python, and Go SDKs so decoding no longer fails when the provider omits a value, while still requiring the member to be present.
What changed:
BREAKING CHANGE: Members FMP can omit on NewsArticle, ExchangeHoliday, EsgDisclosure, EsgRating, CongressionalMemberProfile, CryptocurrencyListing, CrowdfundingOffering, RegulationDOffering, SecCompanyProfile, and SecCompanySearchResult are now optional (Option / pointer / Optional); consumers must handle None.
close #368