OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
[main] WARN o.o.codegen.DefaultCodegen - The following schema has undefined (null) baseType. It could be due to form parameter defined in OpenAPI v2 spec with incorrect consumes. A correct 'consumes' for form parameters should be 'application/x-www-form-urlencoded' or 'multipart/?'
[main] WARN o.o.codegen.DefaultCodegen - codegenModel is null. Default to UNKNOWN_BASE_TYPE
Producing an unusable DefaultApi with calls containing UNKNOWN_BASE_TYPE as parameters where "in: formData" is defined.
openapi-generator version
openapi-generator-cli-4.2.2.jar
OpenAPI declaration file content or url
Simplified Example:
https://gist.github.com/winterwurzel/f6b323eb558c3908653d25fb64cc7745#file-coupons-json
##### Command line used for generation
Description
I have several OpenApi v2 files which consume both regular JSON-data and formData. Even though consumes is defined at root level via:
I still get the following warning:
Producing an unusable DefaultApi with calls containing UNKNOWN_BASE_TYPE as parameters where "in: formData" is defined.
openapi-generator version
openapi-generator-cli-4.2.2.jar
OpenAPI declaration file content or url
Simplified Example: https://gist.github.com/winterwurzel/f6b323eb558c3908653d25fb64cc7745#file-coupons-json ##### Command line used for generationjava -jar openapi-generator-cli-4.2.2.jar generate -g java -i coupons.json -o gensrc
java --version: openjdk 11.0.4 2019-07-17 LTS OpenJDK Runtime Environment (build 11.0.4+0-LTS-sapmachine) OpenJDK 64-Bit Server VM (build 11.0.4+0-LTS-sapmachine, mixed mode)
Steps to reproduce
generate from provided swagger: java -jar openapi-generator-cli-4.2.2.jar generate -g java -i coupons.json -o gensrc
Related issues/PRs
Could not find anything similar.
Suggest a fix/enhancement
None known.
As a workaround on the root level, simply swapping the consumes array order seems to fix it.
Additionally, one could also define "application/x-www-form-urlencoded" in the specific paths which use formData.