marcgibbons / django-rest-swagger

Swagger Documentation Generator for Django REST Framework: deprecated
https://marcgibbons.com/django-rest-swagger/
BSD 2-Clause "Simplified" License
2.59k stars 599 forks source link

How to document the response body? #583

Open wtfuii opened 8 years ago

wtfuii commented 8 years ago

Hello there,

did I miss anything or is there no way to document the response model for requests in django-rest-swagger?

For simple GET requests, the documentation only provides "HTTP Status Code" "200", with an empty Response Model, which should be wrong for most requests.

It seems that coreAPI does not support the documentation of responses, even though this feature is crucial especially for automatic client code generation out of the generated swagger file.

wtfuii commented 8 years ago

There is hope this will be accomplished trough core API: https://github.com/tomchristie/django-rest-framework/issues/4502

hairui commented 8 years ago

I have the same question. It seems that the django-rest-swagger can catch only the success code ( for example 200,204...) from the view code. And I have not seen any error code caught by djang-rest-swagger, even I write that in the views.py.

tovmeod commented 7 years ago

Hi, I saw many people with the same issue or something similar, I pushed the missing features I wish existed between this project, coreapi, coreschema, openapi_codec, and DRF.

I just added the necessary to be able to generate the static swagger file I had. I pushed this so others may be able to use, comment and improve until the features are merged.

I hope others will contribute instead of each rolling his own solution https://github.com/tovmeod/drf-swagger-missing

sdrendall commented 6 years ago

Ended up here and thought I should provide an update. There is real discussion of integrating this in DRF. At the moment however, this appears to be the best thing out there: https://github.com/axnsan12/drf-yasg

For more discussion: https://github.com/encode/django-rest-framework/issues/4502