From drf-yasg to OpenAPI 3¶
drf-yasg is an excellent library and the most popular choice for generating OpenAPI 2.0 / Swagger schemas with DRF. Unfortunately, it currently does not provide OpenAPI 3 support. Migration from drf-yasg to drf-spectacular requires only minor modifications.
@swagger_auto_schemais largely equivalent to
openapi.Parameteris roughly equivalent to
@swagger_serializer_methodis equivalent to
Metaclasses is supported (excluding inlining with
swagger_fake_viewis available as attribute on views to signal schema generation
Responseis largely identical to