-
Notifications
You must be signed in to change notification settings - Fork 224
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
Patterns for structs with single unnamed field #572
Comments
In theory it could be possible for primitive types like Thing is that the validation rules are to be added on schema properties yet This is something that could be explored in future but at the moment the priority for the support is not very high. |
FWIW that happens to be my use case, but I can understand the priority being low. If I can follow up, though: in point of fact I am annotating it this way:
Would some workaround like this allow me to define a pattern? I thought about defining a new type, but I couldn't work out anything specific, because patterns apply only to fields. |
A lot of people use newtypes on primitives. Moreover, since the fields pattern, min, max, ... exist on named structures, wouldn't it be nice to add this feature to unnamed structures? |
Such functionality could be evaluated in future. |
Duplicate #1150 |
For the following struct,
I would like to restrict
T
using some of the options available for structs with named fields, such as restricting aString
to a pattern, or a numerical type to aminimum
andmaximum
. Is there a way to specify this using the#[schema(...)]
macro?The text was updated successfully, but these errors were encountered: