Skip to content

fix: align OptionsChainsData JSON schema with serialized wire format#7487

Closed
sandole wants to merge 2 commits into
OpenBB-finance:developfrom
sandole:fix/options-chains-schema-mismatch
Closed

fix: align OptionsChainsData JSON schema with serialized wire format#7487
sandole wants to merge 2 commits into
OpenBB-finance:developfrom
sandole:fix/options-chains-schema-mismatch

Conversation

@sandole
Copy link
Copy Markdown
Contributor

@sandole sandole commented May 1, 2026

Fixes #7473

Problem

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.

Solution

  • 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

Testing

  • Added comprehensive test coverage in test_options_chains_schema.py
  • Verified schema output matches actual serialized format
  • Confirmed field metadata is preserved

Checklist

  • Tests added
  • Non-breaking change
  • Issue referenced in commit message

sandole and others added 2 commits April 29, 2026 16:12
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
@sandole sandole closed this May 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] OptionsChainsData schema/serializer mismatch: columnar schema vs record-list wire format

1 participant