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 schema error when using pydantic.SecretStr
with a pydantic.Field
#3148
Labels
Bug 🐛
This is something that is not working as expected
Comments
MCVE: from litestar import post
from pydantic import BaseModel, Field, SecretStr
class Something(BaseModel):
password: SecretStr = Field(min_length=8)
@post()
async def something(data: Something) -> Something:
return data
from litestar.testing import create_test_client
with create_test_client([something]) as client:
print(client.get('schema/openapi.json').json()) This only happens when |
provinzkraut
changed the title
Issue from Discord
Bug: OpenAPI schema error when using Mar 1, 2024
pydantic.SecretStr
with a pydantic.Field
Confirmed, #3149 fixes this issue for me. Thanks for such a quick fix! |
This issue has been closed in #3149. The change will be included in the upcoming patch release. |
A fix for this issue has been released in v2.6.2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Reported by seels in Discord: <#1212255742954971207>:
Hey, all. I'm getting the following error when using a
SecretStr
attribute (from Pydantic) and accessing/schema/openapi.json
:type object 'SecretStr' has no attribute 'item_type'
. I've gotSecretStr: str
in mytype_encoders
, but that doesn't seem to help.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: