Files
langchain/libs/core/tests
Emil FilipovandClaude Opus 5 d6cb258484 fix(core): attach the JSON fallbacks via Annotated, not @field_serializer
A `@field_serializer` takes the field's one serializer slot, so any subclass
declaring its own serializer for `func`, `coroutine` or `args_schema` would fail
at class creation with `PydanticUserError: Multiple field serializer functions
were defined`. Those subclasses were valid before this PR.

`PlainSerializer` in the field's `Annotated` metadata leaves the decorator slot
free: a subclass serializer is accepted and takes precedence. Output, dump
options and CPU cost are unchanged (0.014 ms vs 0.134 ms on master for a 12-tool
payload, byte-identical).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-13 18:26:31 +02:00
..