def test_optional_return_type(py_type, expected_type): class OptionalMethodSerializer(serializers.Serializer): x = serializers.SerializerMethodField() def get_x(self, instance): pass # Add the type annotation here in order to avoid a SyntaxError in py27 get_x.__annotations__["return"] = typing.Optional[py_type] class OptionalMethodViewSet(viewsets.ViewSet): @swagger_auto_schema( responses={200: openapi.Response("OK", OptionalMethodSerializer)}) def retrieve(self, request, pk=None): return Response({"optional": None}) router = routers.DefaultRouter() router.register(r"optional", OptionalMethodViewSet, **_basename_or_base_name("optional")) generator = OpenAPISchemaGenerator( info=openapi.Info(title="Test optional parameter", default_version="v1"), patterns=router.urls, ) swagger = generator.get_schema(None, True) property_schema = swagger["definitions"]["OptionalMethod"]["properties"][ "x"] assert property_schema == openapi.Schema(title="X", type=expected_type, readOnly=True)
def test_no_form_parameters_with_non_form_parsers(): # see https://github.com/joellefkowitz/drf-yasg/issues/270 # test that manual form parameters for views that haven't set # all their parsers classes to form parsers are not allowed # even when the request body is empty @method_decorator( name="post", decorator=swagger_auto_schema( operation_description="Logins a user and returns a token", manual_parameters=[ openapi.Parameter( "username", openapi.IN_FORM, required=True, type=openapi.TYPE_STRING, description="Valid username or email for authentication", ), ], ), ) class CustomObtainAuthToken(ObtainAuthToken): throttle_classes = api_settings.DEFAULT_THROTTLE_CLASSES urlpatterns = [ url(r"token/$", CustomObtainAuthToken.as_view()), ] generator = OpenAPISchemaGenerator( info=openapi.Info(title="Test generator", default_version="v1"), patterns=urlpatterns, ) with pytest.raises(SwaggerGenerationError): generator.get_schema(None, True)
def test_url_order(): # this view with description override should show up in the schema ... @swagger_auto_schema(method="get", operation_description="description override") @api_view() def test_override(request, pk=None): return Response({"message": "Hello, world!"}) # ... instead of this view which appears later in the url patterns @api_view() def test_view(request, pk=None): return Response({"message": "Hello, world!"}) patterns = [ url(r"^/test/$", test_override), url(r"^/test/$", test_view), ] generator = OpenAPISchemaGenerator( info=openapi.Info(title="Test generator", default_version="v1"), version="v2", url="", patterns=patterns, ) # description override is successful swagger = generator.get_schema(None, True) assert swagger["paths"]["/test/"]["get"][ "description"] == "description override" # get_endpoints only includes one endpoint endpoints = generator.get_endpoints(None) assert len(endpoints["/test/"][1]) == 1
def test_replaced_serializer(): class DetailSerializer(serializers.Serializer): detail = serializers.CharField() class DetailViewSet(viewsets.ViewSet): serializer_class = DetailSerializer @swagger_auto_schema(responses={ 404: openapi.Response("Not found or Not accessible", DetailSerializer) }) def retrieve(self, request, pk=None): serializer = DetailSerializer({"detail": None}) return Response(serializer.data) router = routers.DefaultRouter() router.register(r"details", DetailViewSet, **_basename_or_base_name("details")) generator = OpenAPISchemaGenerator( info=openapi.Info(title="Test generator", default_version="v1"), version="v2", url="", patterns=router.urls, ) for _ in range(3): swagger = generator.get_schema(None, True) assert "Detail" in swagger["definitions"] assert "detail" in swagger["definitions"]["Detail"]["properties"] responses = swagger["paths"]["/details/{id}/"]["get"]["responses"] assert "404" in responses assert responses["404"]["schema"]["$ref"] == "#/definitions/Detail"
def test_choice_field(choices, expected_type): class DetailSerializer(serializers.Serializer): detail = serializers.ChoiceField(choices) class DetailViewSet(viewsets.ViewSet): @swagger_auto_schema( responses={200: openapi.Response("OK", DetailSerializer)}) def retrieve(self, request, pk=None): return Response({"detail": None}) router = routers.DefaultRouter() router.register(r"details", DetailViewSet, **_basename_or_base_name("details")) generator = OpenAPISchemaGenerator( info=openapi.Info(title="Test generator", default_version="v1"), patterns=router.urls, ) swagger = generator.get_schema(None, True) property_schema = swagger["definitions"]["Detail"]["properties"]["detail"] assert property_schema == openapi.Schema(title="Detail", type=expected_type, enum=choices)
def test_noop_inspectors( swagger_settings, mock_schema_request, codec_json, reference_schema, compare_schemas ): from drf_yasg2 import app_settings def set_inspectors(inspectors, setting_name): inspectors = [__name__ + "." + inspector.__name__ for inspector in inspectors] swagger_settings[setting_name] = ( inspectors + app_settings.SWAGGER_DEFAULTS[setting_name] ) set_inspectors( [NoOpFieldInspector, NoOpSerializerInspector], "DEFAULT_FIELD_INSPECTORS" ) set_inspectors([NoOpFilterInspector], "DEFAULT_FILTER_INSPECTORS") set_inspectors([NoOpPaginatorInspector], "DEFAULT_PAGINATOR_INSPECTORS") generator = OpenAPISchemaGenerator( info=openapi.Info(title="Test generator", default_version="v1"), version="v2", ) swagger = generator.get_schema(mock_schema_request, True) json_bytes = codec_json.encode(swagger) swagger_dict = json.loads(json_bytes.decode("utf-8"), object_pairs_hook=OrderedDict) compare_schemas(swagger_dict, reference_schema)
def test_basepath_only(mock_schema_request): with pytest.raises(SwaggerGenerationError): generator = OpenAPISchemaGenerator( info=openapi.Info(title="Test generator", default_version="v1"), version="v2", url="/basepath/", ) generator.get_schema(mock_schema_request, public=True)
def test_securiy_requirements(swagger_settings, mock_schema_request): generator = OpenAPISchemaGenerator( info=openapi.Info(title="Test generator", default_version="v1"), version="v2", url="", ) swagger_settings["SECURITY_REQUIREMENTS"] = [] swagger = generator.get_schema(mock_schema_request, public=True) assert swagger["security"] == []
def test_no_netloc(mock_schema_request): generator = OpenAPISchemaGenerator( info=openapi.Info(title="Test generator", default_version="v1"), version="v2", url="", ) swagger = generator.get_schema(mock_schema_request, public=True) assert "host" not in swagger and "schemes" not in swagger assert swagger["info"]["version"] == "v2"
def test_invalid_schema_fails(codec_json, mock_schema_request): # noinspection PyTypeChecker bad_generator = OpenAPISchemaGenerator( info=openapi.Info( title="Test generator", default_version="v1", contact=openapi.Contact(name=69, email=[]), ), version="v2", ) swagger = bad_generator.get_schema(mock_schema_request, True) with pytest.raises(codecs.SwaggerValidationError): codec_json.encode(swagger)
def test_json_field(): class TestJSONFieldSerializer(serializers.Serializer): json = serializers.JSONField() class JSONViewSet(viewsets.ModelViewSet): serializer_class = TestJSONFieldSerializer router = routers.DefaultRouter() router.register(r"jsons", JSONViewSet, **_basename_or_base_name("jsons")) generator = OpenAPISchemaGenerator( info=openapi.Info(title="Test json field generator", default_version="v1"), patterns=router.urls, ) swagger = generator.get_schema(None, True) property_schema = swagger["definitions"]["TestJSONField"]["properties"][ "json"] assert property_schema == openapi.Schema(title="Json", type=openapi.TYPE_OBJECT)
def test_nested_choice_in_array_field(choices, field, expected_type): # Create a model class on the fly to avoid warnings about using the several # model class name several times model_class = type( "%sModel" % field.__name__, (fake_models.FakeModel, ), { "array": postgres_fields.ArrayField( field(choices=((i, "choice %s" % i) for i in choices))), "__module__": "test_models", }, ) class ArraySerializer(serializers.ModelSerializer): class Meta: model = model_class fields = ("array", ) class ArrayViewSet(viewsets.ModelViewSet): serializer_class = ArraySerializer router = routers.DefaultRouter() router.register(r"arrays", ArrayViewSet, **_basename_or_base_name("arrays")) generator = OpenAPISchemaGenerator( info=openapi.Info(title="Test array model generator", default_version="v1"), patterns=router.urls, ) swagger = generator.get_schema(None, True) property_schema = swagger["definitions"]["Array"]["properties"]["array"][ "items"] assert property_schema == openapi.Schema(title="Array", type=expected_type, enum=choices)
def test_action_mapping(): class ActionViewSet(viewsets.ViewSet): @swagger_auto_schema(method="get", operation_id="mapping_get") @swagger_auto_schema(method="delete", operation_id="mapping_delete") @action(detail=False, methods=["get", "delete"], url_path="test") def action_main(self, request): """mapping docstring get/delete""" @swagger_auto_schema(operation_id="mapping_post") @action_main.mapping.post def action_post(self, request): """mapping docstring post""" router = routers.DefaultRouter() router.register(r"action", ActionViewSet, **_basename_or_base_name("action")) generator = OpenAPISchemaGenerator( info=openapi.Info(title="Test generator", default_version="v1"), version="v2", url="", patterns=router.urls, ) for _ in range(3): swagger = generator.get_schema(None, True) action_ops = swagger["paths"]["/test/"] methods = ["get", "post", "delete"] assert all(mth in action_ops for mth in methods) assert all(action_ops[mth]["operationId"] == "mapping_" + mth for mth in methods) assert action_ops["post"]["description"] == "mapping docstring post" assert action_ops["get"][ "description"] == "mapping docstring get/delete" assert action_ops["delete"][ "description"] == "mapping docstring get/delete"
1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.urls import path, re_path, include from rest_framework import permissions from drf_yasg2.views import get_schema_view from drf_yasg2 import openapi schema_view = get_schema_view( openapi.Info( title="Tweet API", default_version='v1', description="Welcome to the world of Tweet", terms_of_service="https://www.tweet.org", contact=openapi.Contact(email="*****@*****.**"), license=openapi.License(name="Awesome IP"), ), public=True, permission_classes=(permissions.AllowAny, ), ) urlpatterns = [ re_path(r'^doc(?P<format>\.json|\.yaml)$', schema_view.without_ui(cache_timeout=0), name='schema-json'), path('doc/', schema_view.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'), path('redoc/',
1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.contrib import admin from django.urls import include, path from django.conf import settings from django.conf.urls.static import static from rest_framework import permissions from drf_yasg2.views import get_schema_view from drf_yasg2 import openapi schema_view = get_schema_view( openapi.Info( title="Booking App APi", default_version='v1', description="Test description", terms_of_service="https://www.google.com/policies/terms/", contact=openapi.Contact(email="*****@*****.**"), license=openapi.License(name="BSD License"), ), public=True, permission_classes=(permissions.AllowAny, ), ) urlpatterns = [ path('admin/', admin.site.urls), path('api/v1/', include('api.urls')), path('', schema_view.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'), path('redoc/', schema_view.with_ui('redoc', cache_timeout=0),
2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.contrib import admin from django.urls import path, include from rest_framework import permissions from drf_yasg2.views import get_schema_view from drf_yasg2 import openapi admin.site.site_header = 'IIT BHU Workshops App Backend Administration' schema_view = get_schema_view( openapi.Info( title="IIT BHU Workshops App API", default_version='v1', description=""" This is the official IIT BHU Workshops App API developed using Django Rest Framework. The source code can be found [here](https://github.com/IIT-BHU-InstiApp/lite-hai-backend). """, ), public=True, permission_classes=(permissions.AllowAny, ), ) urlpatterns = [ path('admin/', admin.site.urls), path('', schema_view.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'), path('', include('authentication.urls')), path('', include('config.urls')),
from django.urls import include from rest_framework import permissions from rest_framework.decorators import api_view from drf_yasg2 import openapi from drf_yasg2.views import get_schema_view admin.autodiscover() swagger_info = openapi.Info( title="Snippets API", default_version="v1", description="""This is a demo project for the [drf_yasg2](https://github.com/joellefkowitz/drf-yasg) Django Rest Framework library. The `swagger-ui` view can be found [here](/cached/swagger). The `ReDoc` view can be found [here](/cached/redoc). The swagger YAML document can be found [here](/cached/swagger.yaml). You can log in using the pre-existing `admin` user with password `passwordadmin`.""", # noqa terms_of_service="https://www.google.com/policies/terms/", contact=openapi.Contact(email="*****@*****.**"), license=openapi.License(name="BSD License"), ) SchemaView = get_schema_view( validators=["ssv", "flex"], public=True, permission_classes=(permissions.AllowAny,), ) @api_view(["GET"]) def plain_view(request): pass
# djoser # path('user/', include('djoser.urls')), ] # static path # urlpatterns += [static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)] from rest_framework import permissions from drf_yasg2.views import get_schema_view from drf_yasg2 import openapi schema_view = get_schema_view( openapi.Info( title="2020ELK API", default_version='v1', description="systex B85B project", # terms_of_service="https://www.google.com/policies/terms/", contact=openapi.Contact(email="*****@*****.**"), # license=openapi.License(name="BSD License"), ), # public=True, # patterns=[url(r"^api/", include((es_urls, 'api'), namespace='v1'))], permission_classes=(permissions.AllowAny, ), ) urlpatterns += [ path('swagger/', schema_view.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'), path('redoc/', schema_view.with_ui('redoc', cache_timeout=0), name='schema-redoc'),
ur += google_sheets_urls ur += banner_urls ur += component_urls ur += regulations swagger_urls = [ url(r'^$', SwaggerView.as_view(), name='index'), url(r'^resources/$', ResourcesView.as_view(), name='resources'), url(r'^schema/(?P<resource>\S+)$', SchemaView.as_view()), url(r'^schema/$', SchemaView.as_view(), name='schema'), ] schema_view = get_schema_view( openapi.Info( title="Defect Dojo API", default_version='v2', description="To use the API you need be authorized.", ), # if public=False, includes only endpoints the current user has access to public=True, # The API of a OpenSource project should be public accessible permission_classes=[permissions.AllowAny], ) urlpatterns = [ # These are the SAML2 related URLs. You can change "^saml2_auth/" regex to # any path you want, like "^sso_auth/", "^sso_login/", etc. (required) url(r'^saml2/', include('django_saml2_auth.urls')), # The following line will replace the default user login with SAML2 (optional) # If you want to specific the after-login-redirect-URL, use parameter "?next=/the/path/you/want" # with this view.
from django.conf.urls import url from django.contrib import admin from django.urls import path, include from drf_yasg2 import openapi from drf_yasg2.views import get_schema_view from rest_framework import routers, permissions from rest_framework.authtoken import views import praggregator.views from app.views import ProductViewSet, OfferViewSet schema_view = get_schema_view( openapi.Info( title="Product Aggregator API", default_version='v1', description="Let this be the ultimate source of the Product aggregator knowledge. Use it wisely and if " "anything is wrong, contact the developer.", contact=openapi.Contact(email="*****@*****.**"), ), public=True, permission_classes=(permissions.AllowAny,), ) router = routers.DefaultRouter() router.register(r'products', ProductViewSet) router.register(r'offers', OfferViewSet) urlpatterns = [ path('admin/', admin.site.urls), path('signup/', praggregator.views.signup, name='signup'), path('api/v1/', include(router.urls)),
from drf_yasg2 import openapi from drf_yasg2.views import get_schema_view from rest_framework import routers, permissions, authentication from environments.identities.traits.views import SDKTraits from environments.identities.views import SDKIdentities from features.views import SDKFeatureStates from organisations.views import chargebee_webhook from segments.views import SDKSegments from analytics.views import SDKAnalyticsFlags schema_view = get_schema_view( openapi.Info( title="Flagsmith API", default_version="v1", description="", license=openapi.License(name="BSD License"), contact=openapi.Contact(email="*****@*****.**"), ), public=True, permission_classes=(permissions.AllowAny, ), authentication_classes=(authentication.SessionAuthentication, ), ) traits_router = routers.DefaultRouter() traits_router.register(r"", SDKTraits, basename="sdk-traits") app_name = "v1" urlpatterns = [ url(r"^organisations/",
2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.conf import settings from django.conf.urls import url from django.conf.urls.static import static from django.urls import include, path from drf_yasg2 import openapi from drf_yasg2.views import get_schema_view from ZhiQue import permissions from oauth.views import LoginView, AuthorizeView, LogoutView, OAuthLoginView schema_view = get_schema_view( openapi.Info( title='知雀', default_version='v1', description='知雀接口文档', ), public=True, permission_classes=(permissions.AllowAny, ), ) urlpatterns = [ path('swagger-ui/', schema_view.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'), url(r'^(?P<version>(v1|v2))/account/', include('account.urls', namespace='account')), url(r'^(?P<version>(v1|v2))/oauth/', include('oauth.urls', namespace='oauth')), url(r'^(?P<version>(v1|v2))/yuque/',
from rest_framework import permissions, routers from backend.usage.views import ReportViewSet, StationViewSet, AgentSubmit, AgentReportQuery, AgentStationQuery, EmailReportView, AgentResubmit from backend.users.views import UserInfoViewSet, UserViewSet, ChangePassword, ChangeUserInfo from drf_yasg2.views import get_schema_view from drf_yasg2 import openapi router = routers.DefaultRouter() router.register("station", StationViewSet, basename="station") router.register("usage", ReportViewSet, basename="usage") router.register("userinfo", UserInfoViewSet, basename="userinfo") router.register("user", UserViewSet, basename="user") schema_view = get_schema_view( openapi.Info( title="ibiblio Radiostats Backend API", default_version='v1', contact=openapi.Contact(email="*****@*****.**"), ), public=True, permission_classes=(permissions.AllowAny, ), ) urlpatterns = [ path('api/user/change_password/', ChangePassword.as_view(), name='change_password'), path('api/user/change_userinfo/', ChangeUserInfo.as_view(), name='change_userinfo'), path('api/usage/agent/submit/', AgentSubmit.as_view(), name='agent_submit'),
from django.urls import path, include, re_path from django.conf import settings from django.conf.urls.static import static from rest_framework import permissions from drf_yasg2.views import get_schema_view from drf_yasg2 import openapi from django.views.generic.base import RedirectView admin.site.site_header = "OfferYangu Admin" admin.site.site_title = "OfferYangu Admin Portal" admin.site.index_title = "Welcome to OfferYangu Admin Portal" schema_view = get_schema_view( openapi.Info( title="Offer Yangu API", default_version='v1', description="The official Offer Yangu API documentation", license=openapi.License(name="BSD License"), ), public=True, permission_classes=(permissions.AllowAny,), ) admin.site.site_url = 'https://development.offeryangu.co.ke/' urlpatterns = [ path('', RedirectView.as_view(url='docs')), re_path(r'^docs(?P<format>\.json|\.yaml)$', schema_view.without_ui(cache_timeout=0), name='schema-json'), path('docs', schema_view.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'), path('redoc', schema_view.with_ui('redoc', cache_timeout=0), name='schema-redoc'), path('admin/', admin.site.urls),
from drf_yasg2.views import get_schema_view from drf_yasg2 import openapi from rest_framework import permissions from drf_yasg2.views import get_schema_view from drf_yasg2 import openapi from rest_framework_simplejwt.views import ( TokenObtainPairView, TokenRefreshView, ) schema_view = get_schema_view( openapi.Info( title="SuperBol API", default_version='v1', description="Documentacao", terms_of_service="https://www.google.com/policies/terms/", contact=openapi.Contact(email="*****@*****.**"), license=openapi.License(name="BSD License"), ), public=True, permission_classes=(permissions.AllowAny,), ) router = routers.SimpleRouter() router.register(r'api/gerente', GerenteViewSet) router.register(r'api/administrador', AdministradorViewSet) router.register(r'api/banca', BancaViewSet) router.register(r'api/cambista', CambistaViewSet) router.register(r'api/config', ConfigViewSet) router.register(r'api/cliente', ClienteViewSet) router.register(r'api/plano', PlanoViewSet)
from django.urls import path, re_path from drf_yasg2.views import get_schema_view from drf_yasg2 import openapi from rest_framework import permissions from api.v1.mailing.viewsets import SubscriberViewSet, MailHistoryViewSet schema_view = get_schema_view( openapi.Info( title="헤렌 코딩 테스트", default_version="v1", description="헤렌 코딩 테스트 API 문서입니다 ㅎ-ㅎ", terms_of_service="https://www.google.com/policies/terms/", contact=openapi.Contact(email="*****@*****.**"), license=openapi.License(name="BSD License"), ), public=True, permission_classes=(permissions.IsAdminUser, ), ) urlpatterns = [ path("/subscribe", SubscriberViewSet.as_view({"post": "create"}), name="subscribe"), path( "/unsubscribe", SubscriberViewSet.as_view({"post": "unsubscribe"}), name="unsubscribe", ), path(
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.contrib import admin from django.urls import path, include from rest_framework import permissions from drf_yasg2.views import get_schema_view from drf_yasg2 import openapi # Open api schema schema_view = get_schema_view( openapi.Info( title="Scouts verzekeringen API", default_version="v1", description= "This is the api documentation for the Scouts verzekeringen API", ), public=True, permission_classes=(permissions.AllowAny, ), ) urlpatterns = [ path("api/", include("apps.insurances.urls")), path("api/", include("apps.members.urls")), path("api/", include("apps.equipment.urls")), path("api/", include("apps.locations.urls")), path("api/", include("apps.info.urls")), path("api/auth/", include("apps.scouts_auth.urls")), path("api/oidc/", include("apps.oidc.urls")), path("swagger/",
1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.conf import settings from django.conf.urls import url from django.conf.urls.static import static from django.contrib import admin from django.urls import path, include from drf_yasg2 import openapi from drf_yasg2.views import get_schema_view from rest_framework import permissions schema_view = get_schema_view( openapi.Info(title='musicians_site API', default_version='v1', description='Description', contact=openapi.Contact(email='*****@*****.**'), license=openapi.License(name='BSD License')), public=True, permission_classes=(permissions.AllowAny, ), ) urlpatterns = [ path('admin/', admin.site.urls), path('api/', include('lessons.urls')), path('auth/', include('authentication.urls')), path('static-content/', include('static_content.urls')), url(r'^docs/$', schema_view.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'), ]
from django.contrib import admin from django.urls import path, include, re_path from rest_framework.authtoken.views import obtain_auth_token from rest_framework import permissions from drf_yasg2.views import get_schema_view from drf_yasg2 import openapi from django.conf.urls.static import static from django.views.static import serve from django.conf import settings schema_view = get_schema_view( openapi.Info( title="Arthub API", default_version="v1", description="Application Interface", terms_of_service="https://www.google.com/policies/terms/", contact=openapi.Contact(email="*****@*****.**"), license=openapi.License(name="MIT License"), ), public=True, permission_classes=(permissions.AllowAny, ), ) urlpatterns = [ path("admin/", admin.site.urls), re_path( r"^swagger(?P<format>\.json|\.yaml)$", schema_view.without_ui(cache_timeout=0), name="schema-json", ), re_path(
from django.contrib.auth import views as auth_views from rest_framework_simplejwt import views as jwt_views from rest_framework_simplejwt.views import ( TokenObtainPairView, TokenRefreshView, ) from users.views import UserViewSet from app.views import AppViewSet schema_view = get_schema_view( openapi.Info( title="Digidex portail API", default_version='v1', description="This APi have been made for Digidex design", contact=openapi.Contact(email="doumbialassane10@@gmail.com"), license=openapi.License(name="Personal License"), ), public=True, permission_classes=(permissions.AllowAny, ), ) # Create a router and register our viewsets with it. router = DefaultRouter() #router.register(r'apps', AppList) router.register(r'users', UserViewSet) #router.register(r'app', AppViewSet) urlpatterns = [ path('admin/', admin.site.urls),