You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, it is only possible to validate top-level objects using validate().
However, there are some use-cases where validating a single value like an array would be needed handy.
Example:
Imagine you have a RESTful API where you have an Endpoint that updates a Resource. The body for this request looks as follows:
["value 1","value 2",// ...]
What's currently 'possible'
Currently, there is no easy way to validate the body of the request. A workaround would be to use validateValue but then you would need to implement a lot around that yourselves since it returns a InvalidPayload[] rather than a ValidationResult. validateData is also not useable since it requires the input to be of type InputData which is not compatible with array.
What would be nice to have
To have something like this:
Currently, it is only possible to validate top-level objects using
validate()
.However, there are some use-cases where validating a single value like an
array
would be needed handy.Example:
Imagine you have a RESTful API where you have an Endpoint that updates a Resource. The body for this request looks as follows:
What's currently 'possible'
Currently, there is no easy way to validate the body of the request. A workaround would be to use
validateValue
but then you would need to implement a lot around that yourselves since it returns aInvalidPayload[]
rather than aValidationResult
.validateData
is also not useable since it requires the input to be of typeInputData
which is not compatible witharray
.What would be nice to have
To have something like this:
The text was updated successfully, but these errors were encountered: