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
So I think the BodyValidator should not throw an exception in case an optional request body is not provided in the request.
As well, if a requestBody is required in the spec but not provided in the request, we can directly throw an InvalidBody exception and not try to validate against the schema.
One consequence is that projects using the library might need to add required: true on their endpoints in order to keep the same validation behaviour.
The text was updated successfully, but these errors were encountered:
what's the status here? validating a request with an empty body (RequestValidator->validate($request)) results in a JSON syntax error if requestBody - required: true is not set.
In the OpenApi specification, request bodies are optional by default, unless
required: true
is declared explicitly.So I think the BodyValidator should not throw an exception in case an optional request body is not provided in the request.
As well, if a requestBody is required in the spec but not provided in the request, we can directly throw an InvalidBody exception and not try to validate against the schema.
One consequence is that projects using the library might need to add
required: true
on their endpoints in order to keep the same validation behaviour.The text was updated successfully, but these errors were encountered: