drf-yasg
drf-yasg copied to clipboard
Do not use a leading dot to specify SwaggerRenderer formats
DRF expects that custom Renderers use a simple string for the format
: https://www.django-rest-framework.org/api-guide/renderers/#custom-renderers
This is also required to support content negotiation via DRF's native mechanisms, particularly format_suffix_patterns
: https://www.django-rest-framework.org/api-guide/format-suffixes/
Note that all the other DRF-YASG renderers (including OpenAPIRenderer
and SwaggerUIRenderer
) already do the correct thing. This change just updates the SwaggerJSONRenderer
and SwaggerYAMLRenderer
to be consistent and correct.
Unfortunately, this is not compatible with the existing URL configuration that DRF-YASG's docs have been instructing users to configure. If this is released as-is, it would be a breaking change.
I'm open to ways to working in a compatibility mechanism, if it's agreed that this is a positive change.
@JoelLefkowitz Maybe it would be best to apply semantic versioning here? As it is a breaking change this would belong in version 2.x.x. Maybe there are other changes that are also breaking, these all could be added in 2.x including OpenAPI 3 support.
@creyD i think it's best to roll everything out compatibly and keep the public interfaces consistent with what the bulk of the user base are expecting. To support this url pattern we should extend the customisation support.