Bug Report Checklist
Description
When using the maven plugin, I can specify an Open API Spec file using the <inputSpec>./filename.yaml</inputSpec> tag, or I can specify an <inputSpecRootDirectory>./directory-of-specs/</inputSpecRootDirectory> for it to merge the files before generating the code. When I choose the latter option, I get an error saying inputSpec is required, despite the generator ignoring the input when the inputSpecRootDirectory is specified:
if (StringUtils.isNotBlank(inputSpecRootDirectory)) {
inputSpec = new MergedSpecBuilder(inputSpecRootDirectory, mergedFileName)
.buildMergedSpec();
LOGGER.info("Merge input spec would be used - {}", inputSpec);
}
File inputSpecFile = new File(inputSpec);
As such, the inputSpec parameter should be optional, and validation should check that one of inputSpec or inputSpecRootDirectory is specified (perhaps with a warning if both are given)
openapi-generator version
Latest (7.0.1)
Maven pom.xml
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<!-- RELEASE_VERSION -->
<version>7.0.1</version>
<!-- /RELEASE_VERSION -->
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<!-- <inputSpec>${project.basedir}/src/main/resources/openapi/api.yaml</inputSpec>-->
<inputSpecRootDirectory>${project.basedir}/src/main/resources/openapi</inputSpecRootDirectory>
<generatorName>java</generatorName>
<configOptions>
<sourceFolder>src/gen/java/main</sourceFolder>
</configOptions>
<skipValidateSpec>true</skipValidateSpec>
</configuration>
</execution>
</executions>
</plugin>
https://github.com/fullstack-jack/openapi-generator-maven-plugin-example
Steps to reproduce
- Clone example repo: https://github.com/fullstack-jack/openapi-generator-maven-plugin-example
- Run
mvn generate-sources to see required field error
- Edit pom.xml to pass an arbitrary inputSpec e.g.
<inputSpec>xxx</inputSpec>
- Rerun
mvn generate-sources to see it create sources correctly despite useless inputSpec
Related issues/PRs
none
Suggest a fix
I might get round to creating a PR some time this week but support from anyone else is very welcome.
Bug Report Checklist
Description
When using the maven plugin, I can specify an Open API Spec file using the
<inputSpec>./filename.yaml</inputSpec>tag, or I can specify an<inputSpecRootDirectory>./directory-of-specs/</inputSpecRootDirectory>for it to merge the files before generating the code. When I choose the latter option, I get an error saying inputSpec is required, despite the generator ignoring the input when the inputSpecRootDirectory is specified:As such, the
inputSpecparameter should be optional, and validation should check that one of inputSpec or inputSpecRootDirectory is specified (perhaps with a warning if both are given)openapi-generator version
Latest (7.0.1)
Maven pom.xml
https://github.com/fullstack-jack/openapi-generator-maven-plugin-example
Steps to reproduce
mvn generate-sourcesto see required field error<inputSpec>xxx</inputSpec>mvn generate-sourcesto see it create sources correctly despite useless inputSpecRelated issues/PRs
none
Suggest a fix
I might get round to creating a PR some time this week but support from anyone else is very welcome.