fix: align OptionsChainsData JSON schema with serialized wire format#7487
Closed
sandole wants to merge 2 commits into
Closed
fix: align OptionsChainsData JSON schema with serialized wire format#7487sandole wants to merge 2 commits into
sandole wants to merge 2 commits into
Conversation
OptionsChainsData stores data in columnar format (list[float], list[str], etc.) but model_serializer reshapes it into a list of records for the HTTP response. This caused a schema/wire format mismatch: the OpenAPI schema declared results as an object with columnar list fields, while the REST API actually returned an array of record objects. The mismatch broke schema validation in consumers like openbb-mcp-server and any client that validates HTTP responses against the declared schema. Fix: - Override __get_pydantic_json_schema__ to emit an array-of-records schema - Preserve field metadata (description, x-unit_measurement, etc.) - Non-breaking change: wire format and Python-side helpers remain stable Closes OpenBB-finance#7473
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.
Fixes #7473
Problem
OptionsChainsDatastores data in columnar format (list[float],list[str], etc.) butmodel_serializerreshapes it into a list of records for the HTTP response.This caused a schema/wire format mismatch: the OpenAPI schema declared
resultsas an object with columnar list fields, while the REST API actually returned an array of record objects.The mismatch broke schema validation in consumers like
openbb-mcp-serverand any client that validates HTTP responses against the declared schema.Solution
__get_pydantic_json_schema__to emit an array-of-records schemax-unit_measurement, etc.)Testing
test_options_chains_schema.pyChecklist