Conversation
8701dae to
5311e24
Compare
|
@Ugtan How will this generate swagger specs? Can we host the file on github repo/wiki in some way? |
|
This will generate the api documentation on app/swagger and app/redoc endpoint. I don't think so there is any other way to generate it on wiki rather than writing it manually. @rtgdk |
| path('oauth/', include('social_django.urls', namespace='social')), | ||
| path('auth/', include(("rest_framework_social_oauth2.urls", 'github_auth'), namespace='github_social')), | ||
| path('swagger/', schema_view.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'), | ||
| path('redoc/', schema_view.with_ui('redoc', cache_timeout=0), name='schema-redoc'), |
|
@Ugtan ping |
rtgdk
left a comment
There was a problem hiding this comment.
We need to rethink about drf-yasg module whether it suits our apis. Or we need to change how we model the apis parameters and response and make it visible on the URLs side to make swagger pick up the documentation. This needs to be investigated. Not merging this PR as it doesn't add any value right now.
Let's continue to use the wiki endpoint - https://github.com/spdx/spdx-online-tools/wiki/REST-API-Fields-Request-and-Response for Rest API request and response parameter.
| description="A sample API for learning DRF", | ||
| terms_of_service="https://www.google.com/policies/terms/", | ||
| contact=openapi.Contact(email="hello@example.com"), | ||
| license=openapi.License(name="BSD License"), |
| @renderer_classes((JSONRenderer,)) | ||
| def validate(request): | ||
| """ Handle Validate api request """ | ||
| if request.method == 'GET': |
There was a problem hiding this comment.
Why did we remove all GET endpoints?
| public=True, | ||
| permission_classes=(permissions.AllowAny,), | ||
| ) | ||
|
|
| 'social_django', | ||
| 'oauth2_provider', | ||
| 'rest_framework_social_oauth2', | ||
| 'corsheaders', |
|
@goneall @Ugtan Not merging this to python3 as it doesn't provide any value right now. The swagger spec generated are empty. Maybe we need to rethink where to provide the API request and response structure. drf-yasf doesn't seem to pick up parameters from views.py. Maybe I am missing something here. Open to suggestions on what to do next. |

This PR adds support for API documentation with the help of drf-yasg library.