Beispiel #1
0
        OrphansView.as_view()),
    url(r"^auth/", include("rest_framework.urls")),
    path(settings.ADMIN_SITE_URL, admin.site.urls),
]

urlpatterns.append(
    url(
        r"^{api_root}docs/api.json".format(api_root=API_ROOT),
        SpectacularJSONAPIView.as_view(),
        name="schema",
    ))

urlpatterns.append(
    url(
        r"^{api_root}docs/api.yaml".format(api_root=API_ROOT),
        SpectacularYAMLAPIView.as_view(),
        name="schema-yaml",
    ))

urlpatterns.append(
    url(
        r"^{api_root}docs/".format(api_root=API_ROOT),
        SpectacularRedocView.as_view(
            url="/pulp/api/v3/docs/api.json?include_html=1"),
        name="schema-redoc",
    ))

schema_view = get_schema_view(title="Pulp API",
                              permission_classes=[permissions.AllowAny],
                              generator_class=PulpSchemaGenerator)
Beispiel #2
0
    path("auth/", include("rest_framework.urls")),
    path(settings.ADMIN_SITE_URL, admin.site.urls),
]

urlpatterns.append(
    path(
        f"{API_ROOT}docs/api.json",
        SpectacularJSONAPIView.as_view(authentication_classes=[],
                                       permission_classes=[]),
        name="schema",
    ))

urlpatterns.append(
    path(
        f"{API_ROOT}docs/api.yaml",
        SpectacularYAMLAPIView.as_view(authentication_classes=[],
                                       permission_classes=[]),
        name="schema-yaml",
    ))

urlpatterns.append(
    path(
        f"{API_ROOT}docs/",
        SpectacularRedocView.as_view(
            authentication_classes=[],
            permission_classes=[],
            url="/pulp/api/v3/docs/api.json?include_html=1",
        ),
        name="schema-redoc",
    ))

all_routers = [root_router] + vs_tree.register_with(root_router)
Beispiel #3
0
)

# noinspection PyUnresolvedReferences
from hacktheback.rest.openapi import JSONWebTokenAuthenticationScheme

# URL patterns for hacker APIs
hacker_urlpatterns = [
    path("", include("hacktheback.rest.forms.hacker_urls")),
]

# URL patterns for admin APIs
admin_urlpatterns = [
    path("account/", include("hacktheback.rest.account.admin_urls")),
    path("messenger/", include("hacktheback.rest.messenger.admin_urls")),
    path("", include("hacktheback.rest.forms.admin_urls")),
]

urlpatterns = [
    path("account/", include("hacktheback.rest.account.urls")),
    path("", include(hacker_urlpatterns)),
    path("admin/", include(admin_urlpatterns)),
    path("schema", SpectacularAPIView.as_view(), name="schema"),
    path("schema.json", SpectacularJSONAPIView.as_view(), name="schema-json"),
    path("schema.yaml", SpectacularYAMLAPIView.as_view(), name="schema-yaml"),
    path(
        "swagger",
        SpectacularSwaggerView.as_view(url_name="schema-yaml"),
        name="swagger",
    ),
]
Beispiel #4
0
Class-based views
    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.contrib import admin
from django.urls import path
from drf_spectacular.views import SpectacularJSONAPIView
from drf_spectacular.views import SpectacularRedocView
from drf_spectacular.views import SpectacularSwaggerView
from drf_spectacular.views import SpectacularYAMLAPIView

urlpatterns = [
    # Open API 자체를 조회 : json, yaml,
    path("docs/json/", SpectacularJSONAPIView.as_view(), name="schema-json"),
    path("docs/yaml/", SpectacularYAMLAPIView.as_view(), name="swagger-yaml"),
    # Open API Document UI로 조회: Swagger, Redoc
    path(
        "docs/swagger/",
        SpectacularSwaggerView.as_view(url_name="schema-json"),
        name="swagger-ui",
    ),
    path(
        "docs/redoc/",
        SpectacularRedocView.as_view(url_name="schema-json"),
        name="redoc",
    ),
]