Open tsudmi opened 7 years ago
I'm facing the same problem here. I can't seem to add any more information to the docs, everything is autogenerated, and the YAML docstrings are depreciated.
Same here. I would love to be able to add info to the description field
@gamesbrainiac yes YAML docstrings are deprecated but you can override the SchemaGenerator Class for your own use, as here: https://github.com/m-haziq/django-rest-swagger-docs#advance-usage
Hi @m-haziq , good docs, do you have some examples to use django-rest-swagger
without any models
or database
? In my case, I am creating some API which integrated with several restful API together and add some logic inside. I cannot find any doc explains without models , serialization
Hi @changsijay, thanks for appreciation. Yes definitely you can use it without models , as explained in my docs here: https://github.com/m-haziq/django-rest-swagger-docs#advance-usage No need of models/serialization. Use YAML to describe params. P.S: Sorry for late reply, I was on vacations!
@m-haziq Hello, I have tried your solution but It is not working in django-rest-swagger 2.2.0 version for describing parameters and all.So is there any solution for v2.2.0 ?
The solution I shared above can be used only with:
djangorestframework==3.5.3
django-rest-swagger==2.1.1
in case of "function based views". But if you are using class based views, then you should be able to use this solution normally. What is your case?
I have tried in both function based view and class based view. But it is not working.
In class based view, it is quite simple, as mentioned in official documentation. You have to write serializer and it will show parameters according to serializer class. Please share the specific error you are getting, so that I may be able to help more.
Thanks for replying @m-haziq I am not getting any error. It does not show parameter in swagger UI as per your solution. Do you have example or link for your above suggestion(serializer class)? Please share so that I can refer.
Yes you can clone this repo:
https://github.com/m-haziq/django-rest-swagger-docs
By installing requirements, you can run the project and see inside cbv_demo
how class based views are documented.
@m-haziq In above link there is not any cbv_demo. I have already clone https://github.com/marcgibbons/django-rest-swagger repo and also checked the all files of it. But I did not find the code to describing parameters. And In my django rest api there is not any model.
Currently, it is really hard to understand what value the parameter must have. Please make it possible to specify more details about request parameters. It should be possible to specify at least custom
Data Type
and parameter possible values.For example,
Source: http://petstore.swagger.io/#!/pet/findPetsByTags