|
6 | 6 |
|
7 | 7 | from account.views import LoginView, LogoutView |
8 | 8 | from netbox.api.views import APIRootView, StatusView |
9 | | -from netbox.graphql.schema import schema |
| 9 | +from netbox.graphql.schema import schema_v1, schema_v2 |
| 10 | +from netbox.graphql.utils import get_default_schema |
10 | 11 | from netbox.graphql.views import NetBoxGraphQLView |
11 | 12 | from netbox.plugins.urls import plugin_patterns, plugin_api_patterns |
12 | 13 | from netbox.views import HomeView, MediaView, StaticMediaFailureView, SearchView, htmx |
|
40 | 41 | # HTMX views |
41 | 42 | path('htmx/object-selector/', htmx.ObjectSelectorView.as_view(), name='htmx_object_selector'), |
42 | 43 |
|
43 | | - # API |
| 44 | + # REST API |
44 | 45 | path('api/', APIRootView.as_view(), name='api-root'), |
45 | 46 | path('api/circuits/', include('circuits.api.urls')), |
46 | 47 | path('api/core/', include('core.api.urls')), |
|
54 | 55 | path('api/wireless/', include('wireless.api.urls')), |
55 | 56 | path('api/status/', StatusView.as_view(), name='api-status'), |
56 | 57 |
|
| 58 | + # REST API schema |
57 | 59 | path( |
58 | 60 | "api/schema/", |
59 | 61 | cache_page(timeout=86400, key_prefix=f"api_schema_{settings.RELEASE.version}")( |
|
64 | 66 | path('api/schema/swagger-ui/', SpectacularSwaggerView.as_view(url_name='schema'), name='api_docs'), |
65 | 67 | path('api/schema/redoc/', SpectacularRedocView.as_view(url_name='schema'), name='api_redocs'), |
66 | 68 |
|
67 | | - # GraphQL |
68 | | - path('graphql/', NetBoxGraphQLView.as_view(schema=schema), name='graphql'), |
| 69 | + # GraphQL API |
| 70 | + path('graphql/', NetBoxGraphQLView.as_view(schema=get_default_schema()), name='graphql'), |
| 71 | + path('graphql/v1/', NetBoxGraphQLView.as_view(schema=schema_v1), name='graphql_v1'), |
| 72 | + path('graphql/v2/', NetBoxGraphQLView.as_view(schema=schema_v2), name='graphql_v2'), |
69 | 73 |
|
70 | 74 | # Serving static media in Django to pipe it through LoginRequiredMiddleware |
71 | 75 | path('media/<path:path>', MediaView.as_view(), name='media'), |
|
0 commit comments