concentricsky / django-tastypie-swagger

An adapter to use swagger-ui with django-tastypie.
Other
132 stars 144 forks source link

Using swagger description from tastypie with swagger-codegen #87

Closed mpetyx closed 10 years ago

mpetyx commented 10 years ago

Hello,

I am using django-tastypie-swagger and one colleague of mine wanted to expose a client based on the swagger description. For that reason he tried using swagger-codegen but it failed since it needs swagger 1.2 version. Since the tastypie-swagger utilises the 1.1 version, I tried to upgrade with the swagger-codegen once again which also failed due to the paths that swagger gives internally. The path shows to the API implementation and not the swagger description. A sample of the implementation can be found here, http://openi.herokuapp.com/api/doc/schema/cbsconnector/?api_key=special-key . Do you have any ideas on how to use this description with the swagger-codegen? Thank you very much in advance!

johnraz commented 10 years ago

Did you try with latest master ? I merged some changes lately that are related to codegen - it may fix your issue. I'm still working on 1.2 integration along with tests integration but I'm missing time lately :(

mpetyx commented 10 years ago

To be honest, I played with the pip version. I will try the master and let you know. Thank you!!

mpetyx commented 10 years ago

I just deployed with the latest tastypie-swagger master and the same example can be found here. But still, codegen does not seem to work or even recognise any change yet. I get the same warning when trying to migrate, which is probably some issue with the paths.

WARNING!  Unable to read API //v.04/cbsconnector/
WARNING!  Unable to read API //v.04/cbsconnector/{id}/
johnraz commented 10 years ago

It seems one of the PR was still pending merge... I just merged it. Could you retry with master? In the meantime maybe @willemt or @fehguy can help you a bit with this as I have zero experience with codegen.

mpetyx commented 10 years ago

I just did, you can also find it in the previous link. Same issues. I will try to see if there is a way to overcome those. Any feedback would be more than welcome!

willemt commented 10 years ago

I managed to get codegen working, but only on my own personal "fixes" branch at https://github.com/willemt/django-tastypie-swagger You might want to try that branch out, but YMMV

I'm still in the process of creating pull requests for all of my changes

mpetyx commented 10 years ago

Hello willemt, Thank you very much for your answer. Still, I was not able to resolve my problem. I updated the dependency, on my requirements.txt with git+git://github.com/willemt/django-tastypie-swagger.git@fixes

and posted again an example response here of what i receive. No luck.. Maybe I am doing something generically wrong? I thought the task should be a bit straightforward..

  1. I create my models on django
  2. I expose an API through tastypie
  3. The swagger documentation is also exposed for the API.
  4. Clients can automatically be created for the API.

I miss the last part..

johnraz commented 10 years ago

@mpetyx did you find a way ? If you did solve this it would be nice to tell what was wrong for others ;)

mpetyx commented 10 years ago

The latest commits on the master branch actually managed to fix this. Since the swagger versions changed to 1.2 it could magically compile :dart: