-
Notifications
You must be signed in to change notification settings - Fork 43
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
Consider adding an isValid method #185
Comments
Yeah a validation method would be nice and there are things beyond nullability that we might need to check. A few ideas: For invalid JSON: Builders: Thoughts? |
I like the idea, but it might be a bit too severe to throw out the entire model if, for example, a non-optional field is missing, but the rest of the model may still be of value. A minor back-end bug could lead to a more severe failure than is necessary. Of course that cuts both ways, because failing out early could also save us from severe bugs. I figured that having a
Makes sense. In addition to validation in the setters, I think we'd also want to validate during the |
Just in case it wasn't clear, by "non-optional" field, I'm referring to the fields in the |
Having a |
It would be nice if there was a method had to check if the model is "valid" in the sense that it contains the non-optional set of fields as defined by the schema. This method would allow for defense against invalid-json or mis-use of builders.
The text was updated successfully, but these errors were encountered: