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 602 forks source link

More details about request parameters #615

Open tsudmi opened 7 years ago

tsudmi commented 7 years ago

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, screen shot 2017-02-07 at 16 15 41

Source: http://petstore.swagger.io/#!/pet/findPetsByTags

gamesbrainiac commented 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.

VidJa commented 7 years ago

Same here. I would love to be able to add info to the description field

m-haziq commented 6 years ago

@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

changsijay commented 6 years ago

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

m-haziq commented 6 years ago

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!

dhaval455 commented 5 years ago

@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 ?

m-haziq commented 5 years ago

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?

dhaval455 commented 5 years ago

I have tried in both function based view and class based view. But it is not working.

m-haziq commented 5 years ago

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.

dhaval455 commented 5 years ago

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.

m-haziq commented 5 years ago

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.

dhaval455 commented 5 years ago

@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.