Use drf-spectacular for API docs with swagger and redoc
diff --git a/api/urls.py b/api/urls.py
index 1d062d1..3fb1471 100644
--- a/api/urls.py
+++ b/api/urls.py
@@ -19,14 +19,9 @@
Definition of urls for scorecardapp.
"""
-from datetime import datetime
from django.urls import path, include
-from django.contrib import admin
-from rest_framework.schemas import get_schema_view
-from django.contrib.auth.views import LoginView, LogoutView
-from django.views.generic.base import TemplateView
from rest_framework import routers
-from app import forms, views
+from drf_spectacular.views import SpectacularAPIView, SpectacularRedocView, SpectacularSwaggerView
from api import views as apiViews
@@ -37,18 +32,11 @@
urlpatterns = [
- path('openapi', get_schema_view(
- title="Your Project",
- description="API for all things …",
- version="1.0.0"
- ), name='openapi-schema'),
-
- # Route TemplateView to serve Swagger UI template.
- # * Provide `extra_context` with view name of `SchemaView`.
- path('swagger-ui/', TemplateView.as_view(
- template_name='swagger-ui.html',
- extra_context={'schema_url':'openapi-schema'}
- ), name='swagger-ui'),
+ # API docs
+ path('api/docs/', SpectacularAPIView.as_view(), name='schema'),
+ # Optional UI:
+ path('api/docs/swagger-ui', SpectacularSwaggerView.as_view(url_name='schema'), name='swagger-ui'),
+ path('api/docs/redoc', SpectacularRedocView.as_view(url_name='schema'), name='redoc'),
# API Views
# Wire up our API using automatic URL routing.
diff --git a/openapi-schema.yml b/openapi-schema.yml
deleted file mode 100644
index 2ece14b..0000000
--- a/openapi-schema.yml
+++ /dev/null
@@ -1,373 +0,0 @@
-openapi: 3.0.2
-info:
- title: ''
- version: ''
-paths:
- /api/users/:
- get:
- operationId: listUsers
- description: API endpoint that allows users to be viewed or edited.
- parameters: []
- responses:
- '200':
- content:
- application/json:
- schema:
- type: array
- items:
- $ref: '#/components/schemas/User'
- description: ''
- tags:
- - api
- post:
- operationId: createUser
- description: API endpoint that allows users to be viewed or edited.
- parameters: []
- requestBody:
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/User'
- application/x-www-form-urlencoded:
- schema:
- $ref: '#/components/schemas/User'
- multipart/form-data:
- schema:
- $ref: '#/components/schemas/User'
- responses:
- '201':
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/User'
- description: ''
- tags:
- - api
- /api/users/{id}/:
- get:
- operationId: retrieveUser
- description: API endpoint that allows users to be viewed or edited.
- parameters:
- - name: id
- in: path
- required: true
- description: A unique integer value identifying this user.
- schema:
- type: string
- responses:
- '200':
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/User'
- description: ''
- tags:
- - api
- put:
- operationId: updateUser
- description: API endpoint that allows users to be viewed or edited.
- parameters:
- - name: id
- in: path
- required: true
- description: A unique integer value identifying this user.
- schema:
- type: string
- requestBody:
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/User'
- application/x-www-form-urlencoded:
- schema:
- $ref: '#/components/schemas/User'
- multipart/form-data:
- schema:
- $ref: '#/components/schemas/User'
- responses:
- '200':
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/User'
- description: ''
- tags:
- - api
- patch:
- operationId: partialUpdateUser
- description: API endpoint that allows users to be viewed or edited.
- parameters:
- - name: id
- in: path
- required: true
- description: A unique integer value identifying this user.
- schema:
- type: string
- requestBody:
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/User'
- application/x-www-form-urlencoded:
- schema:
- $ref: '#/components/schemas/User'
- multipart/form-data:
- schema:
- $ref: '#/components/schemas/User'
- responses:
- '200':
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/User'
- description: ''
- tags:
- - api
- delete:
- operationId: destroyUser
- description: API endpoint that allows users to be viewed or edited.
- parameters:
- - name: id
- in: path
- required: true
- description: A unique integer value identifying this user.
- schema:
- type: string
- responses:
- '204':
- description: ''
- tags:
- - api
- /api/groups/:
- get:
- operationId: listGroups
- description: API endpoint that allows groups to be viewed or edited.
- parameters: []
- responses:
- '200':
- content:
- application/json:
- schema:
- type: array
- items:
- $ref: '#/components/schemas/Group'
- description: ''
- tags:
- - api
- post:
- operationId: createGroup
- description: API endpoint that allows groups to be viewed or edited.
- parameters: []
- requestBody:
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/Group'
- application/x-www-form-urlencoded:
- schema:
- $ref: '#/components/schemas/Group'
- multipart/form-data:
- schema:
- $ref: '#/components/schemas/Group'
- responses:
- '201':
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/Group'
- description: ''
- tags:
- - api
- /api/groups/{id}/:
- get:
- operationId: retrieveGroup
- description: API endpoint that allows groups to be viewed or edited.
- parameters:
- - name: id
- in: path
- required: true
- description: A unique integer value identifying this group.
- schema:
- type: string
- responses:
- '200':
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/Group'
- description: ''
- tags:
- - api
- put:
- operationId: updateGroup
- description: API endpoint that allows groups to be viewed or edited.
- parameters:
- - name: id
- in: path
- required: true
- description: A unique integer value identifying this group.
- schema:
- type: string
- requestBody:
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/Group'
- application/x-www-form-urlencoded:
- schema:
- $ref: '#/components/schemas/Group'
- multipart/form-data:
- schema:
- $ref: '#/components/schemas/Group'
- responses:
- '200':
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/Group'
- description: ''
- tags:
- - api
- patch:
- operationId: partialUpdateGroup
- description: API endpoint that allows groups to be viewed or edited.
- parameters:
- - name: id
- in: path
- required: true
- description: A unique integer value identifying this group.
- schema:
- type: string
- requestBody:
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/Group'
- application/x-www-form-urlencoded:
- schema:
- $ref: '#/components/schemas/Group'
- multipart/form-data:
- schema:
- $ref: '#/components/schemas/Group'
- responses:
- '200':
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/Group'
- description: ''
- tags:
- - api
- delete:
- operationId: destroyGroup
- description: API endpoint that allows groups to be viewed or edited.
- parameters:
- - name: id
- in: path
- required: true
- description: A unique integer value identifying this group.
- schema:
- type: string
- responses:
- '204':
- description: ''
- tags:
- - api
- /api/scorecard/:
- get:
- operationId: listScorecardViewSets
- description: List all german data, or create a new GermanDataModel.
- parameters: []
- responses:
- '200':
- content:
- application/json:
- schema:
- type: array
- items: {}
- description: ''
- tags:
- - api
- /api/scorecard/{id}/:
- get:
- operationId: retrieveScorecardViewSet
- description: List all german data, or create a new GermanDataModel.
- parameters:
- - name: id
- in: path
- required: true
- description: ''
- schema:
- type: string
- responses:
- '200':
- content:
- application/json:
- schema: {}
- description: ''
- tags:
- - api
- /api/scorecard/{id}/predict/:
- post:
- operationId: predictScorecardViewSet
- description: List all german data, or create a new GermanDataModel.
- parameters:
- - name: id
- in: path
- required: true
- description: ''
- schema:
- type: string
- requestBody:
- content:
- application/json:
- schema: {}
- application/x-www-form-urlencoded:
- schema: {}
- multipart/form-data:
- schema: {}
- responses:
- '201':
- content:
- application/json:
- schema: {}
- description: ''
- tags:
- - api
-components:
- schemas:
- User:
- type: object
- properties:
- url:
- type: string
- readOnly: true
- username:
- type: string
- description: Required. 150 characters or fewer. Letters, digits and @/./+/-/_
- only.
- pattern: ^[\w.@+-]+\z
- maxLength: 150
- email:
- type: string
- format: email
- maxLength: 254
- groups:
- type: array
- items:
- type: string
- description: The groups this user belongs to. A user will get all permissions
- granted to each of their groups.
- required:
- - username
- Group:
- type: object
- properties:
- url:
- type: string
- readOnly: true
- name:
- type: string
- maxLength: 150
- required:
- - name
diff --git a/requirements.txt b/requirements.txt
index 31809c6..a5a751e 100644
--- a/requirements.txt
+++ b/requirements.txt
Binary files differ
diff --git a/schema.yml b/schema.yml
new file mode 100644
index 0000000..6b2eccd
--- /dev/null
+++ b/schema.yml
@@ -0,0 +1,754 @@
+openapi: 3.0.3
+info:
+ title: Your Project API
+ version: 1.0.0
+ description: Your project description
+paths:
+ /api/abtests/:
+ get:
+ operationId: api_abtests_list
+ description: ''
+ tags:
+ - api
+ security:
+ - cookieAuth: []
+ - basicAuth: []
+ - {}
+ responses:
+ '200':
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/ABTest'
+ description: ''
+ post:
+ operationId: api_abtests_create
+ description: ''
+ tags:
+ - api
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ABTest'
+ application/x-www-form-urlencoded:
+ schema:
+ $ref: '#/components/schemas/ABTest'
+ multipart/form-data:
+ schema:
+ $ref: '#/components/schemas/ABTest'
+ required: true
+ security:
+ - cookieAuth: []
+ - basicAuth: []
+ - {}
+ responses:
+ '201':
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ABTest'
+ description: ''
+ /api/abtests/{id}/:
+ get:
+ operationId: api_abtests_retrieve
+ description: ''
+ parameters:
+ - in: path
+ name: id
+ schema:
+ type: integer
+ description: A unique integer value identifying this ab test.
+ required: true
+ tags:
+ - api
+ security:
+ - cookieAuth: []
+ - basicAuth: []
+ - {}
+ responses:
+ '200':
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ABTest'
+ description: ''
+ put:
+ operationId: api_abtests_update
+ description: ''
+ parameters:
+ - in: path
+ name: id
+ schema:
+ type: integer
+ description: A unique integer value identifying this ab test.
+ required: true
+ tags:
+ - api
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ABTest'
+ application/x-www-form-urlencoded:
+ schema:
+ $ref: '#/components/schemas/ABTest'
+ multipart/form-data:
+ schema:
+ $ref: '#/components/schemas/ABTest'
+ required: true
+ security:
+ - cookieAuth: []
+ - basicAuth: []
+ - {}
+ responses:
+ '200':
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ABTest'
+ description: ''
+ patch:
+ operationId: api_abtests_partial_update
+ description: ''
+ parameters:
+ - in: path
+ name: id
+ schema:
+ type: integer
+ description: A unique integer value identifying this ab test.
+ required: true
+ tags:
+ - api
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/PatchedABTest'
+ application/x-www-form-urlencoded:
+ schema:
+ $ref: '#/components/schemas/PatchedABTest'
+ multipart/form-data:
+ schema:
+ $ref: '#/components/schemas/PatchedABTest'
+ security:
+ - cookieAuth: []
+ - basicAuth: []
+ - {}
+ responses:
+ '200':
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ABTest'
+ description: ''
+ /api/endpoints/:
+ get:
+ operationId: api_endpoints_list
+ description: ''
+ tags:
+ - api
+ security:
+ - cookieAuth: []
+ - basicAuth: []
+ - {}
+ responses:
+ '200':
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/Endpoint'
+ description: ''
+ /api/endpoints/{id}/:
+ get:
+ operationId: api_endpoints_retrieve
+ description: ''
+ parameters:
+ - in: path
+ name: id
+ schema:
+ type: integer
+ description: A unique integer value identifying this endpoint.
+ required: true
+ tags:
+ - api
+ security:
+ - cookieAuth: []
+ - basicAuth: []
+ - {}
+ responses:
+ '200':
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Endpoint'
+ description: ''
+ /api/mlalgorithms/:
+ get:
+ operationId: api_mlalgorithms_list
+ description: ''
+ tags:
+ - api
+ security:
+ - cookieAuth: []
+ - basicAuth: []
+ - {}
+ responses:
+ '200':
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/MLAlgorithm'
+ description: ''
+ /api/mlalgorithms/{id}/:
+ get:
+ operationId: api_mlalgorithms_retrieve
+ description: ''
+ parameters:
+ - in: path
+ name: id
+ schema:
+ type: integer
+ description: A unique integer value identifying this ml algorithm.
+ required: true
+ tags:
+ - api
+ security:
+ - cookieAuth: []
+ - basicAuth: []
+ - {}
+ responses:
+ '200':
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/MLAlgorithm'
+ description: ''
+ /api/mlalgorithmstatuses/:
+ get:
+ operationId: api_mlalgorithmstatuses_list
+ description: ''
+ tags:
+ - api
+ security:
+ - cookieAuth: []
+ - basicAuth: []
+ - {}
+ responses:
+ '200':
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/MLAlgorithmStatus'
+ description: ''
+ post:
+ operationId: api_mlalgorithmstatuses_create
+ description: ''
+ tags:
+ - api
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/MLAlgorithmStatus'
+ application/x-www-form-urlencoded:
+ schema:
+ $ref: '#/components/schemas/MLAlgorithmStatus'
+ multipart/form-data:
+ schema:
+ $ref: '#/components/schemas/MLAlgorithmStatus'
+ required: true
+ security:
+ - cookieAuth: []
+ - basicAuth: []
+ - {}
+ responses:
+ '201':
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/MLAlgorithmStatus'
+ description: ''
+ /api/mlalgorithmstatuses/{id}/:
+ get:
+ operationId: api_mlalgorithmstatuses_retrieve
+ description: ''
+ parameters:
+ - in: path
+ name: id
+ schema:
+ type: integer
+ description: A unique integer value identifying this ml algorithm status.
+ required: true
+ tags:
+ - api
+ security:
+ - cookieAuth: []
+ - basicAuth: []
+ - {}
+ responses:
+ '200':
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/MLAlgorithmStatus'
+ description: ''
+ /api/mlrequests/:
+ get:
+ operationId: api_mlrequests_list
+ description: ''
+ tags:
+ - api
+ security:
+ - cookieAuth: []
+ - basicAuth: []
+ - {}
+ responses:
+ '200':
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/MLRequest'
+ description: ''
+ /api/mlrequests/{id}/:
+ get:
+ operationId: api_mlrequests_retrieve
+ description: ''
+ parameters:
+ - in: path
+ name: id
+ schema:
+ type: integer
+ description: A unique integer value identifying this ml request.
+ required: true
+ tags:
+ - api
+ security:
+ - cookieAuth: []
+ - basicAuth: []
+ - {}
+ responses:
+ '200':
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/MLRequest'
+ description: ''
+ put:
+ operationId: api_mlrequests_update
+ description: ''
+ parameters:
+ - in: path
+ name: id
+ schema:
+ type: integer
+ description: A unique integer value identifying this ml request.
+ required: true
+ tags:
+ - api
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/MLRequest'
+ application/x-www-form-urlencoded:
+ schema:
+ $ref: '#/components/schemas/MLRequest'
+ multipart/form-data:
+ schema:
+ $ref: '#/components/schemas/MLRequest'
+ security:
+ - cookieAuth: []
+ - basicAuth: []
+ - {}
+ responses:
+ '200':
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/MLRequest'
+ description: ''
+ patch:
+ operationId: api_mlrequests_partial_update
+ description: ''
+ parameters:
+ - in: path
+ name: id
+ schema:
+ type: integer
+ description: A unique integer value identifying this ml request.
+ required: true
+ tags:
+ - api
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/PatchedMLRequest'
+ application/x-www-form-urlencoded:
+ schema:
+ $ref: '#/components/schemas/PatchedMLRequest'
+ multipart/form-data:
+ schema:
+ $ref: '#/components/schemas/PatchedMLRequest'
+ security:
+ - cookieAuth: []
+ - basicAuth: []
+ - {}
+ responses:
+ '200':
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/MLRequest'
+ description: ''
+ /api/v1/{endpoint_name}/predict:
+ post:
+ operationId: api_v1_predict_create
+ description: ''
+ parameters:
+ - in: path
+ name: endpoint_name
+ schema:
+ type: string
+ required: true
+ tags:
+ - api
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/GermanDataModel'
+ application/x-www-form-urlencoded:
+ schema:
+ $ref: '#/components/schemas/GermanDataModel'
+ multipart/form-data:
+ schema:
+ $ref: '#/components/schemas/GermanDataModel'
+ required: true
+ security:
+ - cookieAuth: []
+ - basicAuth: []
+ - {}
+ responses:
+ '200':
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/GermanDataModel'
+ description: ''
+ /api/v1/stop_ab_test/{ab_test_id}:
+ post:
+ operationId: api_v1_stop_ab_test_create
+ description: ''
+ parameters:
+ - in: path
+ name: ab_test_id
+ schema:
+ type: string
+ required: true
+ tags:
+ - api
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ABTest'
+ application/x-www-form-urlencoded:
+ schema:
+ $ref: '#/components/schemas/ABTest'
+ multipart/form-data:
+ schema:
+ $ref: '#/components/schemas/ABTest'
+ required: true
+ security:
+ - cookieAuth: []
+ - basicAuth: []
+ - {}
+ responses:
+ '200':
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ABTest'
+ description: ''
+components:
+ schemas:
+ ABTest:
+ type: object
+ properties:
+ id:
+ type: integer
+ readOnly: true
+ title:
+ type: string
+ maxLength: 10000
+ created_by:
+ type: string
+ maxLength: 128
+ created_at:
+ type: string
+ format: date-time
+ readOnly: true
+ ended_at:
+ type: string
+ format: date-time
+ readOnly: true
+ summary:
+ type: string
+ readOnly: true
+ parent_mlalgorithm_1:
+ type: integer
+ parent_mlalgorithm_2:
+ type: integer
+ required:
+ - created_at
+ - created_by
+ - ended_at
+ - id
+ - parent_mlalgorithm_1
+ - parent_mlalgorithm_2
+ - summary
+ - title
+ BlankEnum:
+ enum:
+ - ''
+ Endpoint:
+ type: object
+ properties:
+ id:
+ type: integer
+ readOnly: true
+ name:
+ type: string
+ readOnly: true
+ classifier:
+ type: string
+ readOnly: true
+ created_by:
+ type: string
+ readOnly: true
+ created_at:
+ type: string
+ format: date-time
+ readOnly: true
+ required:
+ - classifier
+ - created_at
+ - created_by
+ - id
+ - name
+ GermanDataModel:
+ type: object
+ properties:
+ id:
+ type: integer
+ readOnly: true
+ age:
+ type: integer
+ maximum: 2147483647
+ minimum: -2147483648
+ sex:
+ oneOf:
+ - $ref: '#/components/schemas/SexEnum'
+ - $ref: '#/components/schemas/BlankEnum'
+ job:
+ type: string
+ maxLength: 100
+ housing:
+ type: string
+ maxLength: 50
+ credit_amount:
+ type: number
+ format: float
+ duration:
+ type: integer
+ maximum: 2147483647
+ minimum: -2147483648
+ purpose:
+ type: string
+ maxLength: 50
+ required:
+ - age
+ - credit_amount
+ - duration
+ - housing
+ - id
+ - job
+ MLAlgorithm:
+ type: object
+ properties:
+ id:
+ type: integer
+ readOnly: true
+ name:
+ type: string
+ readOnly: true
+ description:
+ type: string
+ readOnly: true
+ code:
+ type: string
+ readOnly: true
+ version:
+ type: string
+ readOnly: true
+ created_by:
+ type: string
+ readOnly: true
+ created_at:
+ type: string
+ format: date-time
+ readOnly: true
+ parent_endpoint:
+ type: integer
+ readOnly: true
+ current_status:
+ type: string
+ readOnly: true
+ required:
+ - code
+ - created_at
+ - created_by
+ - current_status
+ - description
+ - id
+ - name
+ - parent_endpoint
+ - version
+ MLAlgorithmStatus:
+ type: object
+ properties:
+ id:
+ type: integer
+ readOnly: true
+ active:
+ type: boolean
+ readOnly: true
+ status:
+ type: string
+ maxLength: 128
+ created_by:
+ type: string
+ maxLength: 128
+ created_at:
+ type: string
+ format: date-time
+ readOnly: true
+ parent_mlalgorithm:
+ type: integer
+ required:
+ - active
+ - created_at
+ - created_by
+ - id
+ - parent_mlalgorithm
+ - status
+ MLRequest:
+ type: object
+ properties:
+ id:
+ type: integer
+ readOnly: true
+ input_data:
+ type: string
+ readOnly: true
+ full_response:
+ type: string
+ readOnly: true
+ response:
+ type: string
+ readOnly: true
+ feedback:
+ type: string
+ nullable: true
+ maxLength: 10000
+ created_at:
+ type: string
+ format: date-time
+ readOnly: true
+ parent_mlalgorithm:
+ type: integer
+ readOnly: true
+ required:
+ - created_at
+ - full_response
+ - id
+ - input_data
+ - parent_mlalgorithm
+ - response
+ PatchedABTest:
+ type: object
+ properties:
+ id:
+ type: integer
+ readOnly: true
+ title:
+ type: string
+ maxLength: 10000
+ created_by:
+ type: string
+ maxLength: 128
+ created_at:
+ type: string
+ format: date-time
+ readOnly: true
+ ended_at:
+ type: string
+ format: date-time
+ readOnly: true
+ summary:
+ type: string
+ readOnly: true
+ parent_mlalgorithm_1:
+ type: integer
+ parent_mlalgorithm_2:
+ type: integer
+ PatchedMLRequest:
+ type: object
+ properties:
+ id:
+ type: integer
+ readOnly: true
+ input_data:
+ type: string
+ readOnly: true
+ full_response:
+ type: string
+ readOnly: true
+ response:
+ type: string
+ readOnly: true
+ feedback:
+ type: string
+ nullable: true
+ maxLength: 10000
+ created_at:
+ type: string
+ format: date-time
+ readOnly: true
+ parent_mlalgorithm:
+ type: integer
+ readOnly: true
+ SexEnum:
+ enum:
+ - 1
+ type: integer
+ securitySchemes:
+ basicAuth:
+ type: http
+ scheme: basic
+ cookieAuth:
+ type: apiKey
+ in: cookie
+ name: Session
diff --git a/scorecardapp/settings.py b/scorecardapp/settings.py
index c7de068..b103bdb 100644
--- a/scorecardapp/settings.py
+++ b/scorecardapp/settings.py
@@ -60,6 +60,7 @@
'django.contrib.messages',
'django.contrib.staticfiles',
'rest_framework',
+ 'drf_spectacular',
]
# Middleware framework
@@ -139,3 +140,15 @@
# https://docs.djangoproject.com/en/2.1/howto/static-files/
STATIC_URL = '/static/'
STATIC_ROOT = posixpath.join(*(BASE_DIR.split(os.path.sep) + ['static']))
+
+REST_FRAMEWORK = {
+ # YOUR SETTINGS
+ 'DEFAULT_SCHEMA_CLASS': 'drf_spectacular.openapi.AutoSchema',
+}
+
+SPECTACULAR_SETTINGS = {
+ 'TITLE': 'Your Project API',
+ 'DESCRIPTION': 'Your project description',
+ 'VERSION': '1.0.0',
+ # OTHER SETTINGS
+}