Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve rendering time for API docs #2980

Closed
jeremystretch opened this issue Mar 7, 2019 · 0 comments
Closed

Improve rendering time for API docs #2980

jeremystretch opened this issue Mar 7, 2019 · 0 comments
Labels
status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application

Comments

@jeremystretch
Copy link
Member

This issue was split off from #2665.

Environment

  • Python version: 3.5.2
  • NetBox version: 2.5.7

Steps to Reproduce

  1. View the API documentation at /api/docs/.

Expected Behavior

The documentation should be rendered within an acceptable amount of time.

Observed Behavior

The page takes a noticeably long time to load, even to the point of prompting the user to kill the script running to render the docs.

Per @axnsan12 on #2665:

This is a real issue, with a two-sided cause:

  • due to some unfortunate design choices, drf-yasg is quite slow; on my machine the XHR request for the swagger document takes around 10 seconds, and there's not really much that can be done to improve this
  • drf-yasg configures swagger-ui with a default defaultModelsExpandDepth of 3, which means the models section at the bottom is fully expanded; this is the main cause of the initial stuttering

You could mitigate the first point by either

a. caching the generated schema
b. pre-rendering the schema during packaging, deployment or app startup

@jeremystretch jeremystretch added type: bug A confirmed report of unexpected behavior in the application status: accepted This issue has been accepted for implementation labels Mar 7, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jan 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
Development

No branches or pull requests

1 participant