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
convert Len
to GroupedMetadata
, add MinLen
and MaxLen
#21
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good enough idea that I'm embarrassed I didn't think of it myself! Two comments:
- needs to be documented in the README too
- I have a little FUD around interpretation of the name Len when I'm going to use this for eg iterables on which it's an error to call len(). Best option IMO is to keep it and I'll add a note like "implementors may also apply this constraint in cases where len() cannot be used but the number of elements is still meaningful, such as iterators"
I'll add to the README. We could call it |
How about |
I'm voting for the existing name, to be clear, just intending to add a one-sentence clarifying note! |
Agreed. |
I think we didn't have
Done. Please review. |
Yeah, but I didn't notice when we added |
Fairly self explanatory, should be backwards compatible.
I need
MinLen
andMaxLen
in pydantic to convert fields arguments to constrains.