-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- What's the version of OpenAPI Generator used?
- Have you search for related issues/PRs?
- What's the actual output vs expected output?
Description
In OpenAPI 3.0+ you can describe query parameters with a content: vs schema:
There's 2 issues
- The swagger core parser doesn't properly resolve query paramters specified with the content tag
- The openapi-generator doesn't have logic to generate the code even if the core parser did resolve the parameters
openapi-generator version
master
OpenAPI declaration file content or url
You can see the yample yaml in the issue I raised with swagger-parser
swagger-api/swagger-parser#1078
Command line used for generation
Take yaml from swagger-api/swagger-parser#1078
Command lline args: generate -g jaxrs-resteasy-eap -i example.yaml -o outputdir
Steps to reproduce
See Yaml from swagger-api/swagger-parser#1078, and attempt to generate client/server code for it.
Related issues/PRs
swagger-api/swagger-parser#1078
Suggest a fix
In org.openapitools.codegen.DefaultCodegen.fromParameter()
We need to do more than check for getSchema()!=null.
If it's null but there's a content specified (i.e. getContent()!=null, we need to pull the scema from the MediaType from the specified content.
Similar to how response bodies are generated with content specified.
But it still requires swagger-api/swagger-parser#1079 in order for the schema objects to be resolved under the specified content/media-type section.
Without that fix, there will be no schema objects in the openAPI context to be able to generate the proper code.
I'm testing a full patch with added unit tests.
I'll submit a PR when I'm done.