mirror of https://github.com/snachodog/mybuddy.git
Add OpenAPI schema endpoint to API (#147)
This commit is contained in:
parent
099e393f36
commit
fddde9d46f
|
@ -474,6 +474,11 @@ header to `Token <user-key>`. E.g.
|
||||||
If the `Authorization` header is not set or the key is not valid, the API will
|
If the `Authorization` header is not set or the key is not valid, the API will
|
||||||
return `403 Forbidden` with additional details in the response body.
|
return `403 Forbidden` with additional details in the response body.
|
||||||
|
|
||||||
|
### Schema
|
||||||
|
|
||||||
|
A live version of the API schema in the [OpenAPI format](https://swagger.io/specification/)
|
||||||
|
is available at the `/api/scehma` path of a running instance.
|
||||||
|
|
||||||
### `GET` Method
|
### `GET` Method
|
||||||
|
|
||||||
#### Request
|
#### Request
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from django.urls import include, path
|
from django.urls import include, path
|
||||||
from rest_framework import routers
|
from rest_framework import routers
|
||||||
|
from rest_framework.schemas import get_schema_view
|
||||||
|
|
||||||
from . import views
|
from . import views
|
||||||
|
|
||||||
|
@ -22,5 +23,10 @@ urlpatterns = [
|
||||||
path('api/auth/', include(
|
path('api/auth/', include(
|
||||||
'rest_framework.urls',
|
'rest_framework.urls',
|
||||||
namespace='rest_framework'
|
namespace='rest_framework'
|
||||||
))
|
)),
|
||||||
|
path('api/schema', get_schema_view(
|
||||||
|
title='Baby Buddy API',
|
||||||
|
version=1,
|
||||||
|
description='API documentation for the Baby Buddy application'
|
||||||
|
), name='openapi-schema'),
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in New Issue