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

Speeding up schema generation #1372

Open
bluesurfer opened this issue Jan 30, 2025 · 0 comments
Open

Speeding up schema generation #1372

bluesurfer opened this issue Jan 30, 2025 · 0 comments

Comments

@bluesurfer
Copy link

bluesurfer commented Jan 30, 2025

I have a project with a large number of API endpoints (40 viewsets - approximately 120 endpoints). I am using spectacular for the docs, I fixed all the warnings but still the schema generation takes quite a lot. By running:

python -m cProfile ./manage.py spectacular --format openapi-json --file schema.json

I get this:

14257450 function calls (13330353 primitive calls) in 12.067

The use of extend_schema and extend_schema_view is just for specifying tags and operation_id. Everything else is autogenerated.

So, I understand that spectacular needs to inspect all the code but are there any best practices which I am missing and that may help reduce the generation time?

Is this ticket going to have any impact #1371?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant