Skip to content

[JAVA] Generating code is referencing a generated model class which is not created #405

@Morac2

Description

@Morac2
Description

Generating Java code from a YAML file is creating code that imports and uses a model class that is never being generated. In this case there are references to org.openapitools.client.model.DocumentCreateWithStreamRequest and org.openapitools.client.model.DocumentUpdateWithStreamRequest classes, but that model class is never created. The code does generate DocumentCreateRequest and DocumentUpdateRequest classes, but the code never uses them. It instead replaces them with their parent class Document. All 4 classes extend Document.

In addition the generated code doesn't check to see if any of the required fields are present. Basically the generated code doesn't even compile, let alone work correctly.

openapi-generator version

All versions from 3.0.2 to 4.0.0-SNAPSHOT (didn't test earlier versions)

OpenAPI declaration file content or url

https://gist.githubusercontent.com/Morac2/b0e4d02e50712082b72e4e72f7b8e3aa/raw/132e609fd599391a1c782bc3ea450883e6098219/test.yaml

Command line used for generation

java -jar openapi-generator-cli.jar generate -l java -i test.yaml -o test_code

Steps to reproduce

Generate code

Related issues/PRs

N/A

Suggest a fix/enhancement

Unknown

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions