Bug Report Checklist
Description
I'm using Asp.Net Core Swashbuckle to generate openapi scheme for my backend. The backend supports multiple content-type variants of application/json. But generated code uses url encoded content type instead of application/json.
Here's generated code output which picks first match which is "application/json-patch+json".
contentType: [
'application/json-patch+json',
'application/json',
'text/json',
'application/_*+json',
].first
But then Did checks if content-type is application/json then uses json encoding but if it isn't, it uses url encoding and my server returns HTTP 415 Unsupported Media Type status.
openapi-generator version
5.1.0
OpenAPI declaration file content or url
The OpenAPI declaration that caused this issue was used for private api. So I couldn't share it here.
Generation Details
Steps to reproduce
Related issues/PRs
Suggest a fix
- Overriding content-type header using command line options provided to generator CLI
- Updating
contentType matching part to choose most suitable match rather than first one
Bug Report Checklist
Description
I'm using Asp.Net Core Swashbuckle to generate openapi scheme for my backend. The backend supports multiple content-type variants of
application/json. But generated code uses url encoded content type instead of application/json.Here's generated code output which picks first match which is "application/json-patch+json".
But then Did checks if content-type is
application/jsonthen uses json encoding but if it isn't, it uses url encoding and my server returns HTTP 415 Unsupported Media Type status.openapi-generator version
5.1.0
OpenAPI declaration file content or url
The OpenAPI declaration that caused this issue was used for private api. So I couldn't share it here.
Generation Details
Steps to reproduce
Related issues/PRs
Suggest a fix
contentTypematching part to choose most suitable match rather than first one