0

I'm trying to generate Open API schema.

settings.py:

SPECTACULAR_SETTINGS = {
  'TITLE': 'TMC Authentication API',
  'DESCRIPTION': 'Description',
  'VERSION': '1.0.0',
  'SERVE_INCLUDE_SCHEMA': False,
  'SWAGGER_UI_DIST': 'SIDECAR',
  'SWAGGER_UI_FAVICON_HREF': 'SIDECAR',
  'REDOC_DIST': 'SIDECAR'
}

urls.py:

path('api/schema/', SpectacularAPIView.as_view(), name='schema'),
path('api/swagger/', SpectacularSwaggerView.as_view(url_name='schema'), name='swagger'),
path('api/redoc/', SpectacularRedocView.as_view(url_name='schema'), name='redoc'),
path('api/auth/token/', oauth2_provider.views.TokenApiView.as_view(), name="token"),
...

When run python manage.py spectacular --file schema.yaml the oauth2_provider urls are not generated.

Any idea ?

1 Answers1

0

Schemas for the oauth2_provider views are not generated automatically. You will need to subclass the views so that drf-spectacular can generate information for them. See this answer https://stackoverflow.com/a/71261293/1785448

Melipone
  • 511
  • 5
  • 7