drf-spectacular¶
Sane and flexible OpenAPI 3 schema generation for Django REST framework.
Documentation is an integral part of API development and OpenAPI 3 is finally here to make that process easier. By using drf-spectacular with Django REST Framework (DRF), your schema and therefore your documentation & client will always stay close to your API.
drf-spectacular works well out of the box, but also provides you with several easy ways to customize the generated OpenAPI 3 schema. It is explicitly designed to work well for documentation (SwaggerUI, ReDoc) and automatic client generation.
Table of Contents¶
- drf-spectacular
- Settings
- Workflow & schema customization
- Client generation
- FAQ
- I use library/app XXX and the generated schema is wrong or broken
- My Swagger UI and/or Redoc page is blank
- I cannot use
@extend_schema
on library code - I get an empty schema or endpoints are missing
- I expected a different schema
- I get duplicated operations with a
{format}
-suffix - I get a lot of warnings
- I get warnings regarding my
Enum
or myEnum
names have a weird suffix - My endpoints use different serializers depending on the situation
- My authentication method is not supported
- How can I i18n/internationalize my schema and UI?
- FileField (ImageField) is not handled properly in the schema
- I’m using
@action(detail=False)
but the response schema is not a list - Using
@extend_schema
onAPIView
has no effect - Where should I put my extensions? / my extensions are not detected
- My
@action
is erroneously paginated or has filter parameters that I do not want - How do I wrap my responses? / My endpoints are wrapped in a generic envelope
- How can I have multiple
SpectacularAPIView
with differing settings - How to correctly annotate function-based views that use
@api_view()
- My
get_queryset()
depends on some attributes not available at schema generation time - How to serve in-memory generated files or files in general outside
FileField
- My
ViewSet
list
does not return a list, but a single object.
- Extension Blueprints
- From drf-yasg to OpenAPI 3
- Contributing to drf-spectacular
- Changelog
- 0.28.0 (2024-11-30)
- 0.27.2 (2024-04-01)
- 0.27.1 (2024-01-18)
- 0.27.0 (2023-12-12)
- 0.26.5 (2023-09-23)
- 0.26.4 (2023-07-23)
- 0.26.3 (2023-06-22)
- 0.26.2 (2023-04-15)
- 0.26.1 (2023-03-18)
- 0.26.0 (2023-03-04)
- 0.25.1 (2022-12-16)
- 0.25.0 (2022-12-13)
- 0.24.2 (2022-09-26)
- 0.24.1 (2022-09-23)
- 0.24.0 (2022-09-14)
- 0.23.1 (2022-07-26)
- 0.23.0 (2022-07-25)
- 0.22.1 (2022-04-25)
- 0.22.0 (2022-03-21)
- 0.21.2 (2022-02-01)
- 0.21.1 (2021-12-20)
- 0.21.0 (2021-11-10)
- 0.20.2 (2021-10-15)
- 0.20.1 (2021-10-03)
- 0.20.0 (2021-10-01)
- 0.19.0 (2021-09-21)
- 0.18.2 (2021-09-04)
- 0.18.1 (2021-08-31)
- 0.18.0 (2021-08-25)
- 0.17.3 (2021-07-26)
- 0.17.2 (2021-06-15)
- 0.17.1 (2021-06-12)
- 0.17.0 (2021-06-01)
- 0.16.0 (2021-05-10)
- 0.15.1 (2021-04-08)
- 0.15.0 (2021-04-03)
- 0.14.0 (2021-03-09)
- 0.13.2 (2021-02-11)
- 0.13.1 (2021-01-21)
- 0.13.0 (2021-01-13)
- 0.12.0 (2020-12-19)
- 0.11.1 (2020-11-15)
- 0.11.0 (2020-11-06)
- 0.10.0 (2020-10-20)
- 0.9.14 (2020-10-04)
- 0.9.13 (2020-09-13)
- 0.9.12 (2020-07-22)
- 0.9.11 (2020-07-08)
- 0.9.10 (2020-06-23)
- 0.9.9 (2020-06-20)
- 0.9.8 (2020-06-07)
- 0.9.7 (2020-06-05)
- 0.9.6 (2020-05-23)
- 0.9.5 (2020-05-20)
- 0.9.4 (2020-05-13)
- 0.9.3 (2020-05-07)
- 0.9.2 (2020-04-27)
- 0.9.1 (2020-04-09)
- 0.9.0 (2020-03-29)
- 0.8.8 (2020-03-21)
- 0.8.5 (2020-03-08)
- 0.8.4 (2020-03-06)
- 0.8.3 (2020-03-02)
- 0.8.2 (2020-03-02)
- 0.8.1 (2020-03-01)
- License
- Package overview