swagger-api / swagger-api/swagger-codegen
[swagger-codegen-maven-plugin] Unable to process multiple inputSpecs
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
Using version 3 of the Swagger Codegen Maven plugin I am unable to run multiple executions each using a different inputSpec. When I do this I get the following error:
[INFO] --- swagger-codegen-maven-plugin:3.0.13:generate (default) @ my-project ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 13.445 s
[INFO] Finished at: 2020-01-02T20:24:38-05:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.swagger.codegen.v3:swagger-codegen-maven-plugin:3.0.13:generate (default) on project my-project: The parameters 'inputSpec', 'language' for goal io.swagger.codegen.v3:swagger-codegen-maven-plugin:3.0.13:generate are missing or invalid -> [Help 1]
For both executions I have an ID specified and its own configuration as follows:
<plugin>
<groupId>io.swagger.codegen.v3</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<executions>
<execution>
<id>content-push</id>
<configuration>
<inputSpec>${project.basedir}/src/main/swagger/contentPush/swagger.yaml</inputSpec>
<language>java</language>
<modelPackage>${content.push.default.client.package}.model</modelPackage>
<apiPackage>${content.push.default.client.package}.api</apiPackage>
<invokerPackage>${content.push.default.client.package}</invokerPackage>
<modelNamePrefix>ContentPush</modelNamePrefix>
<configOptions>
<dateLibrary>java8</dateLibrary>
</configOptions>
</configuration>
</execution>
<execution>
<id>distribution</id>
<configuration>
<inputSpec>${project.basedir}../cpr/xxx-cpr-distribution/src/main/swagger/distribution/swagger.yaml</inputSpec>
<language>java</language>
<modelPackage>${distribution.client.package}.model</modelPackage>
<apiPackage>${distribution.client.package}.api</apiPackage>
<invokerPackage>${distribution.client.package}</invokerPackage>
<modelNamePrefix>Dist</modelNamePrefix>
<configOptions>
<dateLibrary>java8</dateLibrary>
</configOptions>
</configuration>
</execution>
</executions>
</plugin>
If I run either one of them without the ID it works, however if I run just one with the ID specified I get the same error. This leads me to believe the issue is more with the ID being specified, however if I leave out the ID I get the following error:
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[WARNING] 'dependencies.dependency.version' for org.junit.jupiter:junit-jupiter:jar is either LATEST or RELEASE (both of them are being deprecated) @ xxx:my-project:[unknown-version], location\to\the\pom.xml, line 80, column 22
[ERROR] 'build.plugins.plugin[io.swagger.codegen.v3:swagger-codegen-maven-plugin].executions.execution.id' must be unique but found duplicate execution with id default @ xxx:my-project:[unknown-version], location\to\the\pom.xml, line 108, column 32
@
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project xxx:my-project:1.0.49-SNAPSHOT (location\to\the\pom.xml) has 1 error
[ERROR] 'build.plugins.plugin[io.swagger.codegen.v3:swagger-codegen-maven-plugin].executions.execution.id' must be unique but found duplicate execution with id default @ xxx:my-project:[unknown-version], location\to\the\pom.xml, line 108, column 32
Swagger-codegen version
3.0.13 and 3.0.14
Swagger declaration file content or url
N/A
Command line used for generation
N/A
Steps to reproduce
This assumes two valid OpenAPI YAML or JSON files.
- Create a Maven project that will be used to generate the source.
- Add the io.swagger.codegen.v3:swagger-codegen-maven-plugin plugin with one execution to validate everything works.
- Add the second execution and populate and ID for both executions.
Related issues/PRs
Suggest a fix/enhancement
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the Maven configuration with two executions of swagger-codegen-maven-plugin, each with its own ID, inputSpec, and language. Then inspect the plugin's execution-parameter handling. Done means both executions retain their individual configuration and the Maven build completes successfully without duplicate-ID or missing-parameter errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100