Cache /api/schema/ endpoint #9561

Closed
opened 2025-12-29 21:18:58 +01:00 by adam · 2 comments
Owner

Originally created by @mulmat on GitHub (Apr 30, 2024).

Originally assigned to: @mulmat on GitHub.

NetBox version

v3.7.6

Feature type

Change to existing functionality

Proposed functionality

Add caching on the /api/schema/ endpoint with a sane default (maybe 300 seconds?) and with the possibility to configure it in configuration.py

Use case

Generating openapi schema takes some time, caching it would:

  • Decrease response time when doing multiple calls to /api/schema/
  • Lower the resources needed from application server (since less openapi schemas will be generated)

Database changes

None

External dependencies

None

Originally created by @mulmat on GitHub (Apr 30, 2024). Originally assigned to: @mulmat on GitHub. ### NetBox version v3.7.6 ### Feature type Change to existing functionality ### Proposed functionality Add caching on the `/api/schema/ ` endpoint with a sane default (maybe 300 seconds?) and with the possibility to configure it in configuration.py ### Use case Generating openapi schema takes some time, caching it would: - Decrease response time when doing multiple calls to `/api/schema/` - Lower the resources needed from application server (since less openapi schemas will be generated) ### Database changes None ### External dependencies None
adam added the status: acceptedtype: feature labels 2025-12-29 21:18:58 +01:00
adam closed this issue 2025-12-29 21:18:59 +01:00
Author
Owner

@mulmat commented on GitHub (Apr 30, 2024):

I can own this if accepted

@mulmat commented on GitHub (Apr 30, 2024): I can own this if accepted
Author
Owner

@jeremystretch commented on GitHub (Apr 30, 2024):

We actually used to cache the schema definition back in ~v2.11 (see #6423 and 257c0afdb5), before we switched from drf-yasg to spectacular. Unfortunately I don't think spectacular offers caching support natively, so we'd have to implement it ourselves.

@mulmat happy to assign this to you to explore options. Let us know what you find!

@jeremystretch commented on GitHub (Apr 30, 2024): We actually used to cache the schema definition back in ~v2.11 (see #6423 and 257c0afdb5b62c7ea84159d2b46d53ce5a43f3a3), before we switched from drf-yasg to spectacular. Unfortunately I don't think spectacular offers caching support natively, so we'd have to implement it ourselves. @mulmat happy to assign this to you to explore options. Let us know what you find!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#9561