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
Update Version 2.5.3 to 2.6.0 error -> LookupError: Could not find a ref for #/components/schemas/xpto . Maybe you tried to call resolve_ref_schema from within a recursive model? #8689
Comments
Could you please provide a code snippet from which we can reproduce this error? Thanks! |
I managed to debug the application here and found that when I call the function, |
We need a minimal reproducible example that we can run. Would you mind providing that? 🙏 |
@Kludex @sydney-runkle |
I can reproduce the issue on 2.6. |
Somewhat simplified pure-pydantic reproduction of the issue: import typing
from enum import Enum
from pydantic import BaseModel, Field
class AllowedValues(str, Enum):
VAL1 = 'Val1'
VAL2 = 'Val2'
class ModelA(BaseModel):
# Removing the max_length from the Field definition will make the code work
modelA_1: AllowedValues = Field(..., max_length=60)
class ModelB(ModelA):
modelB_1: typing.List[ModelA]
class ModelC(BaseModel):
modelC_1: ModelB
class Model(BaseModel):
b: ModelB
c: ModelC
Model.model_json_schema() I had feared this was also introduced by #8526 but that doesn't seem to be the case. |
I've traced the source of this issue to here: b2aa36a |
Initial Checks
Description
After updating from pydantic 2.5.3 > 2.6.0, updating in my project, it broke all tests, with the problem of
LookupError: Could not find a ref for #/components/schemas/xpto . Maybe you tried to call resolve_ref_schema from within a recursive model?
Example Code
No response
Python, Pydantic & OS Version
The text was updated successfully, but these errors were encountered: