drf-yasg icon indicating copy to clipboard operation
drf-yasg copied to clipboard

Do not use a leading dot to specify SwaggerRenderer formats

Open brianhelba opened this issue 4 years ago • 3 comments

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.

brianhelba avatar Oct 29 '20 02:10 brianhelba

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.

brianhelba avatar Oct 29 '20 02:10 brianhelba

@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 avatar Jul 19 '22 07:07 creyD

@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.

JoelLefkowitz avatar Jul 19 '22 08:07 JoelLefkowitz