python-openapi / openapi-core

Openapi-core is a Python library that adds client-side and server-side support for the OpenAPI v3.0 and OpenAPI v3.1 specification.
BSD 3-Clause "New" or "Revised" License
299 stars 132 forks source link

Confusion with the Request.body type #828

Closed p1c2u closed 5 months ago

p1c2u commented 5 months ago

Discussed in https://github.com/python-openapi/openapi-core/discussions/824

Originally posted by **berislavlopac** April 6, 2024 On this line: https://github.com/python-openapi/openapi-core/blob/44b8b3cb11158449be7646171cf0d8782415d02c/openapi_core/protocols.py#L20 the type of the `BaseRequest.body` property is defined as `Optional[bytes]`; however, the docstring of the `Request` protocol (which inherits `body` from `BaseRequest`) says: > body > The request body, as string. I'm currently having some issue with the validation, but it's not clear which direction should I go with the solution -- should `body` be `bytes` or `str`? Have I missed something? Thank you!