luolingchun / flask-openapi3

Generate REST API and OpenAPI documentation for your Flask project.
https://luolingchun.github.io/flask-openapi3/
MIT License
189 stars 29 forks source link

extra_responses are requiring content key (and only keeping content) #35

Closed Colin-b closed 2 years ago

Colin-b commented 2 years ago

According to the OpenAPI specification, content is not a required key within a response. However current code is requiring content to add an extra response: https://github.com/luolingchun/flask-openapi3/blob/71c4ca9ef17a0b5b82c865d5a8f1c7c37fef72c3/flask_openapi3/utils.py#L297

And it also assume that extra_responses only contains content, discarding provided description, headers and links.

extra_responses is currently the only way to describe responses not containing a body (ie: HTTP 201 / HTTP 204) and thus should allow to set any information OpenAPI specification allow in a response.

Please tell me if you want me to draft a pull request for this bug fix / enhancement.

Thanks again

luolingchun commented 2 years ago

Welcome PR.

Colin-b commented 2 years ago

PR is #37