-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
👽️ Ensure compatibility with Pydantic 2.12.0 #14036
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
base: master
Are you sure you want to change the base?
Conversation
d7ada00
to
a9d228a
Compare
I think we should try to avoid adding new dependency. Maybe something with from dirty_equals import IsOneOf
v1 = {
"age": {
"title": "Age",
"anyOf": [
{"exclusiveMinimum": 0.0, "type": "number"},
{"type": "string"},
],
}
}
v2 = {
"age": {
"title": "Age",
"anyOf": [
{"exclusiveMinimum": 0.0, "type": "number"},
{"type": "string", "pattern": r"^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$"},
],
}
}
expected = {
"age": {
"title": "Age",
"anyOf": [
{"exclusiveMinimum": 0.0, "type": "number"},
IsOneOf(
{"type": "string"},
{"type": "string", "pattern": r"^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$"}
),
],
}
}
assert v1 == expected
assert v2 == expected |
a9d228a
to
dbe54cb
Compare
Ah yes, that works too, thanks. Amended. |
`tests/test_multi_body_errors.py::test_openapi_schema` failed with pydantic 2.12.0a1 due to pydantic/pydantic#11987. Since we're testing the exact contents of the JSON schema, the easiest fix seems to be to add version-dependent handling for this.
dbe54cb
to
b5790dc
Compare
I just tried running this branch with pydantic 2.12.0a1, and I have 4 failed tests
|
These are due to pydantic/pydantic#12028. In that PR, @Viicos wrote:
But I really don't follow what FastAPI is doing here; it seems to be something to do with |
tests/test_multi_body_errors.py::test_openapi_schema
failed with pydantic 2.12.0a1 due topydantic/pydantic#11987. Since we're testing the exact contents of the JSON schema, the easiest fix seems to be to add version-dependent handling for this.