Skip to content
Snippets Groups Projects

Add API documentation

Merged Konrad Mohrfeldt requested to merge feature/api-docs into master
2 files
+ 79
163
Compare changes
  • Side-by-side
  • Inline
Files
2
  • Most of the queryset filtering for subroutes formerly implemented
    through custom get_queryset methods can happen semi-automated through a
    mixin, making the behaviour re-usable and allowing us strip a lot of
    additional logic for retrieving objects.
    
    The use of the viewset get_object method also allows us to implement
    object access with permission classes in the future, and should make a
    whole lot of other code obselete.
    
    This change is primarily motivated by the fact that documentation of the
    API will become a lot easier if the subroutes don’t impose arbitrary
    restrictions on the specific subpath under which an operation is
    allowed. For instance updating a schedule should be possible through
    either /schedules/<pk>/ or
    /shows/<show_pk>/schedules/<schedule_pk>/ as long as all the necessary
    data is present in the request body.
+ 14
0
@@ -109,6 +109,19 @@ REST_FRAMEWORK = {
"program.auth.OidcOauth2Auth",
],
"DEFAULT_FILTER_BACKENDS": ["django_filters.rest_framework.DjangoFilterBackend"],
"DEFAULT_SCHEMA_CLASS": "drf_spectacular.openapi.AutoSchema",
"EXCEPTION_HANDLER": "steering.views.full_details_exception_handler",
}
SPECTACULAR_SETTINGS = {
"TITLE": "AURA Steering API",
"DESCRIPTION": "Programme/schedule management for Aura",
"POSTPROCESSING_HOOKS": [
"drf_spectacular.hooks.postprocess_schema_enums",
"steering.schema.add_enum_documentation",
"steering.schema.fix_schedule_pk_type",
],
"VERSION": "1.0.0",
}
INSTALLED_APPS = (
@@ -125,6 +138,7 @@ INSTALLED_APPS = (
"rest_framework",
"rest_framework_nested",
"django_filters",
"drf_spectacular",
"oidc_provider",
"corsheaders",
)
Loading