Bug Report Checklist
Description
The generated Java model files contain an import for ...invoker.JSON but this class does not exist because option generateSupportingFiles=false
(Also, there is no reference to the JSON class in the body of the code so the import can safely be removed.)
openapi-generator version
5.0.0-SNAPSHOT git revision 4dc8d2a
This is a regression. This error does not occur in 4.3.1
OpenAPI declaration file content or url
openapi: 3.0.1
info:
title: Bug Report
description: Demonstration of bug in openapi-generator 5.0.0-SNAPSHOT git revision 4dc8d2a3514af15ac13624d4dc8e2e179749e5bd
version: 1
paths: {}
components:
schemas:
Pojo:
type: object
additionalProperties: false
properties:
Dummy:
type: string
Generation Details
Config file:
generatorName: java
outputDir: bug
library: native
inputSpec: bug.yaml
templateDir: modules/openapi-generator/src/main/resources/Java
apiPackage: bug.api
modelPackage: bug.model
invokerPackage: bug.invoker
packageName: bug.openapi
generateModelDocs: false
generateModelTests: false
generateApiTests: false
generateAliasAsModel: false
generateSupportingFiles: false
generateModelDocumentation: false
generateApiDocumentation: false
generateModels: true
generateApis: false
additionalProperties:
java8: true
dateLibrary: java8
serializationLibrary: jackson
Steps to reproduce
Store the OpenApi declaration file pasted above into bug.yaml
Store the generator config file pasted above into bug-config.yaml
Run openapi-generator:
$ mkdir -p bug
$ bin/generate-samples.sh bug-config.yaml
Related issues/PRs
Somewhat similar but different: #8016
Suggest a fix
The following line needs some decision logic so that it is only included if the supporting files have been generated:
modules/openapi-generator/src/main/resources/Java/libraries/native/model.mustache:49:import {{invokerPackage}}.JSON;
There are about 7 repetitions of this in other mustache files.
Bug Report Checklist
Description
The generated Java model files contain an import for ...invoker.JSON but this class does not exist because option generateSupportingFiles=false
(Also, there is no reference to the JSON class in the body of the code so the import can safely be removed.)
openapi-generator version
5.0.0-SNAPSHOT git revision 4dc8d2a
This is a regression. This error does not occur in 4.3.1
OpenAPI declaration file content or url
Generation Details
Config file:
Steps to reproduce
Store the OpenApi declaration file pasted above into
bug.yamlStore the generator config file pasted above into
bug-config.yamlRun openapi-generator:
Related issues/PRs
Somewhat similar but different: #8016
Suggest a fix
The following line needs some decision logic so that it is only included if the supporting files have been generated:
There are about 7 repetitions of this in other mustache files.