Repository navigation
RFC: Custom Controller Validation (draft) #15
matthewmueller
announced in
Proposals
Replies: 2 comments
|
There's an existing discussion about using validator here: #171 |
0 replies
|
This would be a good solution I think. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
For more complex validation, you can define a
Validmethod on an input type:If validation fails, you get a 400 Bad Request response with your error message:
{ "error": "name is not long enough" }Validation also works with other input types:
If validation fails, you get a
400 Bad Requestresponse. Since email is a key within the request map, we can provide more information in the error message:{ "error": "email is not valid", "fields": { "email": "is not valid" } }Open Questions
ValidatevsValid? IMOValidatesounds more like an action that would return an error, butValidis shorter.All reactions