Skip to content
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

Allow us to specify response headers #283

Closed
sergei-maertens opened this issue Feb 1, 2021 · 1 comment
Closed

Allow us to specify response headers #283

sergei-maertens opened this issue Feb 1, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@sergei-maertens
Copy link
Contributor

I'm on drf-spectacular==0.12.0 - and looking at the code it seems it's not currently possible to document response headers

It's also not listed in the 0.13.x release notes, so I don't think it exists :-)

Is this planned? If not, I could probably make a PR.

@tfranzel
Copy link
Owner

tfranzel commented Feb 1, 2021

@sergei-maertens, nobody has ever asked for it and i didn't need it yet but it certainly makes sense to support it.

i imagine folding those parameters into @extend_schema(parameters=[...]). I would recycle OpenApiParameter as it already provides everything that is needed (except for a response parameter with default False). we handled this in a similar fashion in OpenApiExample.

very doable with a small set of changes. feel free to do a PR, we would certainly include this feature. 👍

@tfranzel tfranzel added the enhancement New feature or request label Feb 1, 2021
sergei-maertens added a commit to maykinmedia/drf-spectacular that referenced this issue Feb 15, 2021
Response headers are sourced from the @extend_schema(parameters=[...])
decorator.

Response headers can apply for every response (global, default) or
only be applicable to a particular response status code (e.g. Location
header on HTTP 201 Created responses). Specifying the response as
either a boolean or a dict mapping status code to boolean serves
both situations.
sergei-maertens added a commit to maykinmedia/drf-spectacular that referenced this issue Feb 15, 2021
Response headers are sourced from the @extend_schema(parameters=[...])
decorator.

Response headers can apply for every response (global, default) or
only be applicable to a particular response status code (e.g. Location
header on HTTP 201 Created responses). Specifying the response as
either a boolean or a dict mapping status code to boolean serves
both situations.
sergei-maertens added a commit to maykinmedia/drf-spectacular that referenced this issue Feb 16, 2021
Response headers are sourced from the @extend_schema(parameters=[...])
decorator.

Response headers can apply for every response (global, default) or
only be applicable to a particular response status code (e.g. Location
header on HTTP 201 Created responses). Specifying the response as
either a boolean or a dict mapping status code to boolean serves
both situations.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants