def test_get_urls_no_root_view(self): router = Router(trailing_slash=False) router.include_root_view = False router.register(LeafViewSet) urls = router.get_urls() base_names = [url.name for url in urls] self.assertNotIn("api-root", base_names)
def test_get_urls_no_format_suffixes(self): router = Router(trailing_slash=False) router.include_format_suffixes = False router.register(LeafViewSet) urls = router.get_urls() patterns = [url.pattern._regex for url in urls] # noqa for pattern in patterns: self.assertNotIn(".(?P<format>[a-z0-9]+)", pattern)
from drf_jsonapi.routers import Router from .views import TrunkViewSet, LeafViewSet router = Router(trailing_slash=False) router.register(TrunkViewSet) router.register(LeafViewSet) urlpatterns = router.urls
openapi.Info( title="Vacasa Housekeeping API", default_version="v1", contact=openapi.Contact(email="*****@*****.**"), ), validators=[], public=True, permission_classes=(AllowAny, ), generator_class=OpenAPISchemaGenerator, ) urlpatterns = [ re_path( r"swagger(?P<format>.json|.yaml)$", schema_view.without_ui(cache_timeout=1), name="schema-json", ), path("spec", schema_view.with_ui("redoc", cache_timeout=1), name="schema-redoc"), ] router = Router(trailing_slash=False) router.register(TestView) urlpatterns += router.urls non_standard_endpoint = path("nonstandard/<uuid>", NonStandardViewSet.as_view({"get": "get_item"})) urlpatterns += [non_standard_endpoint]