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
Unless I'm mistaken, there is no easy way to dissect a RequestError into something useful for the user.
Take the following
requestError := err.(*openapi3filter.RequestError)
fmt.Println(requestError.Error())
/* output:
@body.name:
Error at "/name":Field must be set to string or not be present
Schema:
{
"example": "doggie",
"type": "string"
}
Value:
"number, integer"
*/
Further errors are just seperated via pipe and become unreadable quickly.
Would it make sense to define additional properties on the RequestError?
// RequestError is returned by ValidateRequest when request does not match OpenAPI spec
type RequestError struct {
Input *RequestValidationInput
Parameter *openapi3.Parameter
RequestBody *openapi3.RequestBody
ErrorItems []struct {
Path string // "/name"
ValidationError string // "Field must be set to string or not be present"
}
Reason string
Err error
}
The text was updated successfully, but these errors were encountered:
Unless I'm mistaken, there is no easy way to dissect a RequestError into something useful for the user.
Take the following
Further errors are just seperated via pipe and become unreadable quickly.
Would it make sense to define additional properties on the RequestError?
The text was updated successfully, but these errors were encountered: