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

Add descriptions to responses. #345

Closed
apollo13 opened this issue Mar 25, 2021 · 8 comments
Closed

Add descriptions to responses. #345

apollo13 opened this issue Mar 25, 2021 · 8 comments
Labels
enhancement New feature or request fix confirmation pending issue has been fixed and confirmation from issue reporter is pending

Comments

@apollo13
Copy link

Describe the feature
@extend_schema currently lists many ways to document responses, but none of them allow setting the description. I am not sure what would be a good way to do so, maybe make the value in the dict a tuple of description & actual response?

drf-yasg did allow for this like this (not saying that I particularly like that approach):

ping_response = openapi.Response("response description", PingOutputSerializer)
@swagger_auto_schema(
    method="get",
    ...
    responses={200: ping_response},
)

Any ideas? I might be able to offer the code if there is a clear path :)

@tfranzel
Copy link
Owner

are you referring to this specific description string?

description: ''

this has been asked a few times before and i was not aware of the existing solution in yasg. you are however aware that the serializer docstring is in fact used? at the moment we are only missing the individual docstring on the status_code (e.g.200) level. i suppose this is useful after all. we would have to do a similar construction as yasg to support this.

@apollo13
Copy link
Author

apollo13 commented Mar 25, 2021 via email

@tfranzel
Copy link
Owner

@apollo13 has this been resolved for you or does the feature request remain?

@apollo13
Copy link
Author

I haven't checked yet. But I guess that adding an empty serializer will make it show up in the schema as well, so I guess I'd still would love to see a more lightweight solution

@samfrances
Copy link

As far as I can see, the docstring from the serializer doesn't end up in the response description. Am I doing something wrong?

@tfranzel
Copy link
Owner

tfranzel commented Apr 1, 2021

we now support this analog to drf-yasg.

@tfranzel tfranzel added enhancement New feature or request fix confirmation pending issue has been fixed and confirmation from issue reporter is pending labels Apr 1, 2021
@apollo13
Copy link
Author

apollo13 commented Apr 2, 2021 via email

@tfranzel
Copy link
Owner

tfranzel commented Apr 3, 2021

closing this issue for now. feel free to comment if anything is missing or not working and we will follow-up.

@tfranzel tfranzel closed this as completed Apr 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request fix confirmation pending issue has been fixed and confirmation from issue reporter is pending
Projects
None yet
Development

No branches or pull requests

3 participants