-
-
Notifications
You must be signed in to change notification settings - Fork 347
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
Bug: OpenAPI docs fail to generate with certain validators and pydantic v1 #3471
Closed
2 of 4 tasks
Labels
Bug 🐛
This is something that is not working as expected
Comments
peterschutt
added a commit
that referenced
this issue
May 7, 2024
Fix issue where a pydantic v1 field annotation is wrapped with `Optional` if it is marked not required, but has a default value. Closes #3471
Can you test against https://github.com/litestar-org/litestar/tree/3471-pydantic-v1-field-default please? |
peterschutt
added a commit
that referenced
this issue
May 7, 2024
Fix issue where a pydantic v1 field annotation is wrapped with `Optional` if it is marked not required, but has a default value. Closes #3471
peterschutt
added a commit
that referenced
this issue
May 7, 2024
Fix issue where a pydantic v1 field annotation is wrapped with `Optional` if it is marked not required, but has a default value. Closes #3471
@peterschutt Tested & verified, thanks! What version is this change gonna be in? |
This issue has been closed in #3476. The change will be included in the upcoming patch release. |
A fix for this issue has been released in v2.9.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
OpenAPI docs fail to generate when a request payload is a pydantic v1 model and has a str field with a validator combination of a default(or default_factory) and max_length. Removing any of the validators resolves the issue; it's only reproducible with their combination.
Reproducible with:
Python: 3.11.6
Litestar: 2.8.2
Pydantic: 1.10.15
URL to code causing the issue
No response
MCVE
Steps to reproduce
Screenshots
"![SCREENSHOT_DESCRIPTION](SCREENSHOT_LINK.png)"
Logs
Litestar Version
2.8.2
Platform
Note
While we are open for sponsoring on GitHub Sponsors and
OpenCollective, we also utilize Polar.sh to engage in pledge-based sponsorship.
Check out all issues funded or available for funding on our Polar.sh dashboard
The text was updated successfully, but these errors were encountered: