api-spec-converter icon indicating copy to clipboard operation
api-spec-converter copied to clipboard

OpenAPI3 "placeholder" feature conversion to swagger2

Open glumn opened this issue 7 years ago • 2 comments

The OpenAPI3 spec allows us to specify the same format for multiple media types using placeholders.

To define the same format for multiple media types, you can also use placeholders like */*, application/*, image/* or others

Currently, using that syntax would result in simply loosing our content definition once converted to swagger2, with the following log:

unsupported request body media type

Should those placeholders be supported and generate the content types for every MIME type supported by swagger 2 ?

glumn avatar Mar 12 '18 10:03 glumn

I think Swagger 2 supports all MIME types, so hypothetically application/* could match an infinite number of types (if you include vendor extensions).

Maybe we could add an option to pass in an array of supported MIME types (without placeholders) which would be expanded by the converter. We could also have a sane default with the most common MIME types.

rbren avatar Mar 12 '18 16:03 rbren

That seems reasonable, it also has the advantage of allowing us to throw vendor specific types to the mix

glumn avatar Mar 12 '18 17:03 glumn