-
Notifications
You must be signed in to change notification settings - Fork 77
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
Dropwizard-like validation #24
Comments
One way I envision this is being able to add some additional tags to my request structs, like so: type MyRequest struct {
ID string `json:"id" validate:"notempty"`
Name string `json:"name"`
} If a POST request came in with a MyRequest body that didn't have an ID, then it would return a 400 with some information about why. I have been searching to see if any go libraries exist that do this, but I haven't found anything yet. |
This seems like a good use of tags. I like it. |
@bigkevmcd Perfect! This package is exactly what I wanted. |
Just for reference, the link @bigkevmcd provided is dead. Here is the new one: https://github.com/go-validator/validator |
Dropwizard has a nice integration with Hibernate Validator that makes it easy to give good error messages when the user provides an incorrect JSON payload (e.g. missing a key).
See: http://dropwizard.codahale.com/manual/core/#validation
The text was updated successfully, but these errors were encountered: