Bug Report Checklist
Description
For a property like the following:
lifeCycle:
type: object
$ref: "LifeCycle"
the generated code might end up using java.lang.Object as the type instead of the generated LifeCycle model.
openapi-generator version
7.24.0
OpenAPI declaration file content or url
openapi.yaml
Generation Details
config.json
Steps to reproduce
- in a directory X, create
openapi.yaml and config.json with the contents as above
- from within X, run
docker run --rm -v .:/local openapitools/openapi-generator-cli:v7.24.0 generate --strict-spec true --input-spec /local/openapi.yaml --generator-name spring --config /local/config.json --output /local/output
- open the generated BankAccount model:
./output/src/main/java/org/openapitools/model/BankAccount.java
actual: private @Nullable Object lifeCycle = null;
expected: private @Nullable LifeCycle lifeCycle;
Related issues/PRs
#13295
Suggest a fix
Note that the allOf is required to reproduce the bug.
OpenAPINormalizer logs a warning:
[main] WARN o.o.codegen.OpenAPINormalizer - Type(s) cleared (set to null) given $ref is set to #/components/schemas/LifeCycle.
The related issue is not tied to a specific generator, so I assume this issue is generic as well.
Bug Report Checklist
Description
For a property like the following:
the generated code might end up using
java.lang.Objectas the type instead of the generatedLifeCyclemodel.openapi-generator version
7.24.0
OpenAPI declaration file content or url
openapi.yaml
Generation Details
config.json
Steps to reproduce
openapi.yamlandconfig.jsonwith the contents as abovedocker run --rm -v .:/local openapitools/openapi-generator-cli:v7.24.0 generate --strict-spec true --input-spec /local/openapi.yaml --generator-name spring --config /local/config.json --output /local/output./output/src/main/java/org/openapitools/model/BankAccount.javaactual:
private @Nullable Object lifeCycle = null;expected:
private @Nullable LifeCycle lifeCycle;Related issues/PRs
#13295
Suggest a fix
Note that the
allOfis required to reproduce the bug.OpenAPINormalizer logs a warning:
The related issue is not tied to a specific generator, so I assume this issue is generic as well.