Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23160

How can I set max string field length constraint in Pydantic?

$
0
0

So, I have pydantic model with a string field:

class MyPydanticModel(BaseModel):    name: Optional[str]

And I want to set the max length for this field to 10. How can I do this?


Viewing all articles
Browse latest Browse all 23160

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>