OpenAPI, Swagger and Redoc

Note

This feature was introduced in RDMO 2.3.

Optionally, RDMO can be configured to use drf-spectacular, which provides:

To enable those features install the openapi dependency group together with RDMO:

pip install rdmo[openapi]

Then add the following to your `config/settings/local.py:

INSTALLED_APPS += [
    'drf_spectacular',
    'drf_spectacular_sidecar'
]

REST_FRAMEWORK.update({
    'DEFAULT_SCHEMA_CLASS': 'drf_spectacular.openapi.AutoSchema',
    'DEFAULT_VERSIONING_CLASS': 'rest_framework.versioning.URLPathVersioning',
    'DEFAULT_VERSION': 'v1',
    'ALLOWED_VERSIONS': ('v1', ),
})

and the following to your config/urls.py:

urlpatterns = [
    path('', home, name='home'),
    path('about/', about, name='about'),
    path('api/', api, name='api'),

    path('', include('rdmo.core.urls')),
    path('api/v1/', include('rdmo.core.urls.v1')),
    path('api/v1/', include('rdmo.core.urls.v1.openapi')),  # <-- this line

    path('admin/', admin.site.urls),
]