Open ahopkins opened 5 years ago
bar: str = middle.field(length=4)
This is valid. I did not check before posting this. Perhaps an error message in this case would be helpful?
ValueError: 'min_length' is equal to 'max_length'. Instead, consider using 'length'.
@ahopkins well, length
should not be a valid keyword (I think it's derived from attrs
), only min_length
and max_length
, as described in the OpenAPI 3 specs. Perhaps the length=X
could be a shorthand for min_length=X, max_length=X
as well?
I think it should be. Seems like a very useful shorthand. Especially if you are going to drop attrs as a dependency.
But... that's just one man's opinion 😉
0.2.2
3.7.3
Alpine Linux v3.9
Description
Set a length requirement for a
str
What I Did
This seems like it should be possible. Or, perhaps: