Netbox API doc pages should not depend on external ressouces (JS, CSS) #7850

Closed
opened 2025-12-29 20:28:59 +01:00 by adam · 0 comments
Owner

Originally created by @amhn on GitHub (Apr 1, 2023).

Originally assigned to: @arthanson on GitHub.

NetBox version

v3.5-beta

Feature type

Change to existing functionality

Proposed functionality

This only affects the current beta with the openapi spec. The swagger spec in 3.4.7 is served completely by the netbox instance.

The needed resources to access the API documentation pages should (at least optionally) be added as dependency.

This requires a new dependency drf-spectacular-sidecar.

Settings that need to be added:

SPECTACULAR_SETTINGS = {
    [...]
    'SWAGGER_UI_DIST': 'SIDECAR',
    'SWAGGER_UI_FAVICON_HREF': 'SIDECAR',
    'REDOC_DIST': 'SIDECAR', 
    [...]

See https://drf-spectacular.readthedocs.io/en/latest/faq.html?highlight=ENUM_NAME_OVERRIDES#my-swagger-ui-and-or-redoc-page-is-blank

Use case

In a scenario where netbox is running in an isolated network it should still be possible to access the API docs, e.g. disaster recovery with non working internet access.

Database changes

None

External dependencies

drf-spectacular-sidecar

Originally created by @amhn on GitHub (Apr 1, 2023). Originally assigned to: @arthanson on GitHub. ### NetBox version v3.5-beta ### Feature type Change to existing functionality ### Proposed functionality This only affects the current beta with the openapi spec. The swagger spec in 3.4.7 is served completely by the netbox instance. The needed resources to access the API documentation pages should (at least optionally) be added as dependency. This requires a new dependency drf-spectacular-sidecar. Settings that need to be added: ```python SPECTACULAR_SETTINGS = { [...] 'SWAGGER_UI_DIST': 'SIDECAR', 'SWAGGER_UI_FAVICON_HREF': 'SIDECAR', 'REDOC_DIST': 'SIDECAR', [...] ``` See https://drf-spectacular.readthedocs.io/en/latest/faq.html?highlight=ENUM_NAME_OVERRIDES#my-swagger-ui-and-or-redoc-page-is-blank ### Use case In a scenario where netbox is running in an isolated network it should still be possible to access the API docs, e.g. disaster recovery with non working internet access. ### Database changes None ### External dependencies drf-spectacular-sidecar
adam added the status: acceptedtype: featurebeta labels 2025-12-29 20:28:59 +01:00
adam closed this issue 2025-12-29 20:28:59 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#7850