Skip to content

fix(STEF-2854): add Pydantic serializer to Quantile to suppress warnings#838

Closed
egordm wants to merge 1 commit intorelease/v4.0.0from
fix/STEF-2854-quantile-pydantic-serialization
Closed

fix(STEF-2854): add Pydantic serializer to Quantile to suppress warnings#838
egordm wants to merge 1 commit intorelease/v4.0.0from
fix/STEF-2854-quantile-pydantic-serialization

Conversation

@egordm
Copy link
Collaborator

@egordm egordm commented Mar 18, 2026

Closing — this fix has been incorporated into PR #837 (fix/STEF-2854-handle-insufficient-training-data).

Quantile.__get_pydantic_core_schema__ only defined a validator but no
serializer. When Quantile values appear as dict keys in a union type
(e.g., QuantileOrGlobal = Quantile | Literal['global']), Pydantic emits
PydanticSerializationUnexpectedValue warnings during model_dump_json().

Add a plain_serializer_function_ser_schema(float) so Pydantic knows
how to serialize Quantile as a float, preventing the warning.

Signed-off-by: Egor Dmitriev <[email protected]>
@egordm egordm requested a review from a team March 18, 2026 09:08
@github-actions github-actions bot added the fix Something isn't working label Mar 18, 2026
@sonarqubecloud
Copy link

@egordm egordm closed this Mar 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant