parent
6d65ab7030
commit
57a1ed2410
3 changed files with 41 additions and 24 deletions
@ -0,0 +1,36 @@ |
||||
from drf_yasg.views import get_schema_view |
||||
from drf_yasg import openapi |
||||
from drf_yasg.generators import OpenAPISchemaGenerator |
||||
from drf_yasg.views import get_schema_view |
||||
from rest_framework import permissions |
||||
|
||||
class SubTagSchemaGenerator(OpenAPISchemaGenerator): |
||||
def get_schema(self, request=None, public=False): |
||||
schema = super().get_schema(request, public) |
||||
# Add x-tagGroups extension for ReDoc |
||||
schema['x-tagGroups'] = [ |
||||
{ |
||||
"name": "v1", |
||||
"tags": ["token", "conversations"] |
||||
} |
||||
] |
||||
return schema |
||||
|
||||
schema_view = get_schema_view( |
||||
openapi.Info( |
||||
title="Botzilla API", |
||||
default_version='v1', |
||||
description="Botzilla API documentation", |
||||
terms_of_service="https://www.example.com/terms/", |
||||
contact=openapi.Contact(email="contact@botzilla.ch"), |
||||
license=openapi.License(name="BSD License"), |
||||
x_logo={ |
||||
"url": "/static/logo.svg", |
||||
"backgroundColor": "#FFFFFF", |
||||
"altText": "Botzilla logo" |
||||
} |
||||
), |
||||
public=True, |
||||
permission_classes=[permissions.AllowAny], |
||||
generator_class=SubTagSchemaGenerator |
||||
) |
Loading…
Reference in New Issue