Method docstrings not included in generated docs #537
Comments
Looks like django-rest-framework doesn't support it yet =P encode/django-rest-framework#4241
|
I also have this problem, the old version of rest swagger imported doc strings, and also showed dictionaries in the doc string nicely formatted, Is there an option to manually include them? |
Also looking for a solution |
I also have this problem |
Also the same problem. But when I make a GET request with the DRF API, docstrings appear on top of the result page. |
It seems this project has nothing to do with the problem. The schema generation part is now(restframework 3.4+) done by restframework and this project merely uses generated coreapi objects to render swagger.json. |
This project will have to implement it with DRF supports it. I did a quick hack to my local DRF to include the docstrings, verified that they are output in the XHR request, but did not appear in the django-rest-swagger front-end. |
As a quick workaround, try the following: class SchemaGenerator(schemas.SchemaGenerator):
def get_link(self, path, method, callback, view):
# link is an instance of `coreapi.Link`
link = super(
SchemaGenerator, self).get_link(path, method, callback, view)
action = self.get_action(path, method, callback)
func = getattr(view, action, None)
if func:
link._description = func.__doc__
return link |
Yeah, that was the quick hack I did. Seems like something similar to this could be used to workaround #536 as well. Seems like swagger uses the "tags" list that is output so we'd just need to munge that a bit |
I think it also doesn't support the Generic Views doc strings. |
@paulosuzart Yeah, that's right. |
@paulosuzart For generic views you can see my attempt in encode/django-rest-framework#4444 |
Docstring introspection is now provided in DRF 3.5+. Closing out. |
I recently upgraded from 0.3.5 to 2.0.4. Previously, docstrings on view methods (MyView.get) would be included in the swagger generated docs, but with the new version I don't get any docs included. It does seem to introspect serializer fields and such, but the docstrings help users of the API understand what an endpoint does and when to use it. Is there any way to get those included with the current release?
The text was updated successfully, but these errors were encountered: