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
An empty application/x-www-form-urlencoded request body unexpectedly fails to validate even if it should satisfy the schema, such as when all parameters are optional.
Traceback (most recent call last):
File "/home/anders/python/openapi-core/test.py", line 56, in <module>
validate_request(request, spec=spec) # error
File "/home/anders/python/openapi-core/openapi_core/shortcuts.py", line 321, in validate_request
validate_apicall_request(
File "/home/anders/python/openapi-core/openapi_core/shortcuts.py", line 396, in validate_apicall_requestreturn v.validate(request)
File "/home/anders/python/openapi-core/openapi_core/validation/request/validators.py", line 279, in validateraise err
File "/home/anders/python/openapi-core/openapi_core/validation/request/validators.py", line 114, in _iter_errorsself._get_body(request.body, request.content_type, operation)
File "/home/anders/python/openapi-core/openapi_core/validation/decorators.py", line 35, in wrapperself._raise_error(exc, self.err_cls, f, *args, **kwds)
File "/home/anders/python/openapi-core/openapi_core/validation/decorators.py", line 31, in wrapperreturn f(*args, **kwds)
File "/home/anders/python/openapi-core/openapi_core/validation/request/validators.py", line 259, in _get_body
raw_body =self._get_body_value(body, request_body)
File "/home/anders/python/openapi-core/openapi_core/validation/request/validators.py", line 269, in _get_body_valueraise MissingRequestBody
openapi_core.validation.request.exceptions.MissingRequestBody: Missing request body
Oh additionally, requestBody.required is supposed to default to false. (But I’m pretty sure an empty body that meets the schema should be allowed even if required is true?)
Actual Behavior
An empty
application/x-www-form-urlencoded
request body unexpectedly fails to validate even if it should satisfy the schema, such as when all parameters are optional.Expected Behavior
No error.
Steps to Reproduce
OpenAPI Core Version
current Git (efaa5ac)
OpenAPI Core Integration
none
Affected Area(s)
No response
References
No response
Anything else we need to know?
No response
Would you like to implement a fix?
None
The text was updated successfully, but these errors were encountered: