-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
duplicate use of the model's wrap serializer #11812
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
PydanticAI Github Bot Found 1 issues similar to this one: |
Defining a custom There's a first issue happening: for Pydantic models, the core schema is cached in the What you need to do is manually reusing the cached attribute: @classmethod
def __get_pydantic_core_schema__(cls, source, handler):
schema = cls.__dict__.get('__pydantic_core_schema__')
if schema is not None and isinstance(schema, dict):
return cls.__pydantic_core_schema__
return pydantic_core.core_schema.union_schema(
[
handler(cls),
# anything goes here, using duplicate schema for the example
handler(cls),
]
) The main issue still persists though, and I think it is indeed related to #11505. We knew the fix wasn't robust enough, so a different approach needs to be taken. |
thank you for the workaround 🙏.
does this mean this will get dropped completely? i'm heavily relying on it, especially for custom types, hence the ask. |
Sorry I meant Defining a custom |
Uh oh!
There was an error while loading. Please reload this page.
Initial Checks
Description
this was introduced by 2.11(.x?).
this is probably related to #11505.
Example Code
Python, Pydantic & OS Version
The text was updated successfully, but these errors were encountered: