We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
String numerical values ("10") are accepted as integers.
"10"
Unmarshal request should return an error.
api.yml
openapi: 3.0.0 info: title: test version: '0.1' servers: - url: /test paths: /sending: put: summary: Send integer requestBody: content: application/json: schema: type: object additionalProperties: false properties: my_integer: type: integer responses: 200: description: Ok.
test_request.py
import json from openapi_core import OpenAPI from openapi_core.contrib.starlette import StarletteOpenAPIRequest from starlette.requests import Request def starlette_request(path: str): return Request({ "type": "http", "method": "PUT", "path": path, "headers": [(b"content-type", b"application/json; charset=utf-8")], "query_string": "", }) body = json.dumps({"my_integer": "10"}) spec = OpenAPI.from_file_path("api.yml") request = StarletteOpenAPIRequest(starlette_request("/test/sending"), body=body) result = spec.unmarshal_request(request) print(result.errors)
0.19.0
starlette
Unmarshaling
Reading the guide for OpenAPI 3.0.0 from swagger, it states that numbers in strings are not accepted as integers.
Is this a feature? Previously this was not the case and I found out about this change because I updated from 0.16.6 to 0.19.0.
0.16.6
None
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Actual Behavior
String numerical values (
"10"
) are accepted as integers.Expected Behavior
Unmarshal request should return an error.
Steps to Reproduce
api.yml
test_request.py
OpenAPI Core Version
0.19.0
OpenAPI Core Integration
starlette
Affected Area(s)
Unmarshaling
References
Reading the guide for OpenAPI 3.0.0 from swagger, it states that numbers in strings are not accepted as integers.
Anything else we need to know?
Is this a feature? Previously this was not the case and I found out about this change because I updated from
0.16.6
to0.19.0
.Would you like to implement a fix?
None
The text was updated successfully, but these errors were encountered: