-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#165305752 Document API using swagger #11
#165305752 Document API using swagger #11
Conversation
-install django-rest-swagger -add swagger settings to the settings file -add swagger url -change the views to From apiview to genericapiviews -update requirements.txt -add the swagger url in the readme [Finishes #165305752]
@@ -10,7 +10,7 @@ | |||
) | |||
|
|||
|
|||
class RegistrationAPIView(APIView): | |||
class RegistrationAPIView(GenericAPIView): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @Amoswachira ,
Did this task require changing the superclass for the view from APIView to GenericAPIView?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Ogutu-Brian No, but there was an issue the parameters in the swagger documentation were not appearing when using the APIView so I change it to GenericAPIView and The parameters box appeared where a user is required to input the JSON data.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this imply that when I use APIView I will not be able to document my endpoint? We used APIViews before and we documented our endpoints with swagger. Would you check what could be amiss?
Did you get a reason as to why the APIViews could not be documented but Generic views?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Ogutu-Brian This is a much efficient way as compared to what we had been doing in the past projects. when you use APIView you will have to create a separate file like swagger.py where you will have to add all the parameters manually which is tedious but when one uses GenericViews and Implements it this way. The parameters will be picked up automatically
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @Amoswachira ,
Imagine situations, where APIViews are more efficient to use or another developer onboarding onto the codebase, is confident with APIViews, they might feel limited or devs might be limited on the classes they can use from a framework.
If introducing the swagger.py file would solve the problem now and in future, then I suggest that we go that way. This would provide a lasting solution
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Ogutu-Brian it will not limit you. After what I demonstrated to you this morning i hope everything is fine now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it is
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…5752 #165305752 Document API using swagger
…5752 #165305752 Document API using swagger
Description
Setup Swagger and Add swagger Documentation to the already existing API endpoints.
Type of change
How Has This Been Tested?
Please describe the tests that you ran to verify your changes
Checklist:
Pivotal Tracker
165305752
Screenshot