Skip to content

Commit 7abcc7a

Browse files
Merge pull request #3993 from hSaria/3935-swagger-default-info
Fixes #3935: Swagger DEFAULT_INFO
2 parents 00b50f9 + 1b26afd commit 7abcc7a

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

netbox/netbox/settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,7 @@ def _setting(name, default=None):
503503
'utilities.custom_inspectors.IdInFilterInspector',
504504
'drf_yasg.inspectors.CoreAPICompatInspector',
505505
],
506+
'DEFAULT_INFO': 'netbox.urls.openapi_info',
506507
'DEFAULT_MODEL_DEPTH': 1,
507508
'DEFAULT_PAGINATOR_INSPECTORS': [
508509
'utilities.custom_inspectors.NullablePaginatorInspector',

netbox/netbox/urls.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,16 @@
99
from users.views import LoginView, LogoutView
1010
from .admin import admin_site
1111

12+
openapi_info = openapi.Info(
13+
title="NetBox API",
14+
default_version='v2',
15+
description="API to access NetBox",
16+
terms_of_service="https://github.com/netbox-community/netbox",
17+
license=openapi.License(name="Apache v2 License"),
18+
)
19+
1220
schema_view = get_schema_view(
13-
openapi.Info(
14-
title="NetBox API",
15-
default_version='v2',
16-
description="API to access NetBox",
17-
terms_of_service="https://github.com/netbox-community/netbox",
18-
license=openapi.License(name="Apache v2 License"),
19-
),
21+
openapi_info,
2022
validators=['flex', 'ssv'],
2123
public=True,
2224
)

0 commit comments

Comments
 (0)