-
-
Notifications
You must be signed in to change notification settings - Fork 136
BUG: Unmarshalling nullable objects #232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
Comments
Can confirm given issue. I've managed to fix it by entirely remove |
Here's a minimal example I could whip up: from openapi_core import create_spec
from openapi_core.validation.request.datatypes import RequestParameters, OpenAPIRequest
from openapi_core.validation.request.validators import RequestValidator
spec_dict = {
"openapi": "3.0.1",
"info": {"title": "Test Spec", "version": "0.0.0"},
"servers": [{"url": "http://localhost"}],
"paths": {
"/test": {
"post": {
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"foo": {
"type": "object",
"nullable": True
},
}
}
}
}
},
"responses": {"204": {"description": "Empty response."}}
}
}
}
}
spec = create_spec(spec_dict)
request_body = '{"foo": null}'
request = OpenAPIRequest(
full_url_pattern="http://localhost/test",
method="post",
parameters=RequestParameters(),
body=request_body,
mimetype="application/json",
)
result = RequestValidator(spec).validate(request) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Uh oh!
There was an error while loading. Please reload this page.
According to my tests, the latest
openapi-core
release (0.13.3
at the time of this writing) is ignoring thenullable
keyword when unmarshalling an object, so it fails here:I will write a quick minimum test case when I have a minute, opening this now if someone can take a look.
The text was updated successfully, but these errors were encountered: