Closed emman27 closed 7 years ago
What is the purpose of the documentation.yaml file? Is it autogenerated? Does it need to be maintained? I was under the impression that swagger updated automatically
Hey, I actually just went through the process of switching the brew_data views/urls to use ViewSets and DefaultRouter. Can you see if you can make swagger work with this now? I didn't have any real luck
No, it's not autogenerated. It's a mapping of your serializers and URLs with the necessary validation. And yes, it needs to be maintained. There are several hosting solutions for it but that's a choice you'll have to make.
I can look into your new changes. Will take a look later when I have my laptop
Alright, much appreciated. I just want to be sure the framework is correctly wired together with the application before merging anything
I've made the necessary changes. It should now display your endpoints. Note that the autogenerated docs are less comprehensive than the documentaion.yml file I've written for you - this is a pending issue on django_rest_framework itself (see https://github.com/encode/django-rest-framework/issues/4502).
There's also a generate_docs script if you want the simple stuff. It's nowhere near as powerful as writing your own, which I've already done for you, but it's the basis I suppose.
Awesome! I'll take a look when I can later (hopefully I'll have a few hours in the airport to get a few PRs merged in). Thanks!
Looks much better, any idea how to get either the "Authorization" or "Django Login" to login using the JSONWebTokenAuthentication
?
@emman27 Ran into some issues merging/resolving. Ended up accidently overwriting some other merges into master, had to revert. Can you pull this branch and make sure it works as expected? Then I can merge it in. The only weird thing I notice is that the endpoints are no longer grouped by 'data', 'accounts', etc. https://github.com/BrewCenter/BrewCenterAPI/tree/docs
I've actually done 2 things here.
Django Rest Swagger is added as a project dependency and the relevant views are available at /documentation. This should support your future development should you choose to go down the path of viewsets and routers, as recommended by rest_framework itself.
I've also added a documentation.yaml file to your project - in the OpenAPI 3.0 format documenting your custom views, with data schemas which are rather extensible (I hope). This should also support your needs if you decide for something more customized.
You're not supposed to read the yaml file directly. Try opening it in any OpenAPI 3.0 visualization tool (I like https://temando.github.io/open-api-renderer/demo/) or Swagger Editor Resolves #29
Sorry for the repeated PR! Forgot about the 1st October thing