-
Notifications
You must be signed in to change notification settings - Fork 10
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
Introducing OneOf
and NoneOf
#42
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.
Looks good!
Left a comment but I'm not sure it's a significant concern.
I've only reviewed genericvalidator
package as you mentioned.
70ac46e
to
00d6c85
Compare
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.
LGTM. Couple of minor comments but nothing blocking. Guess the only question I have is around naming of the internal pkg, for instance are we going to use primitivevalidator
and collectionvalidator
, complexvalidator
etc.
About the For the collections, I don't have a better name 🤷 , so I'd go for something like |
The underlying implementation sits in `primitivevalidator` package.
9dff486
to
2fc01f4
Compare
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions. |
Closes #7
Closes #8
Closes #9
Validators added here, per package:
int64validator
OneOf(int64...)
,NoneOf(int64...)
float64validator
OneOf(float64...)
,NoneOf(float64...)
numbervalidator
OneOf(*big.Float...)
,NoneOf(*big.Float...)
stringvalidator
OneOf(bool, float64...)
,NoneOf(bool, float64...)
bool
parameter is to enable/disable case sensitivityThe validators are designed to restrict use to the primitive types, and it will throw errors if used against any collection type.
Implementation for all but the
stringvalidator
package is provided by theprimitivevalidator
package, that holds the bulk of the logic.