swagger-api / swagger-api/swagger-codegen

[Spring] only the last one will be generated in multiple inputSpec

Open
#8,687 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

I am using the following pom configuration to generate Controllers:

		<plugin>
		    <groupId>io.swagger</groupId>
		    <artifactId>swagger-codegen-maven-plugin</artifactId>
		    <version>2.3.1</version>
		    <executions>
		        <execution>
        			<id>first-service-api</id>
		            <goals>
		                <goal>generate</goal>
		            </goals>
		            <configuration>
		                <inputSpec>${project.basedir}/src/main/resources/api/administration.yaml</inputSpec>
		                <language>spring</language>
		                <configOptions>
		                   <sourceFolder>src/gen/java/main</sourceFolder>
		                </configOptions>
		                <apiPackage>${default.package}.controller</apiPackage>
		                <modelPackage>${default.package}.model</modelPackage>
		                <generateSupportingFiles>false</generateSupportingFiles>
		                <skip>false</skip>
		            </configuration>
		        </execution>
		        <execution>
        			<id>second-service-api</id>
		            <goals>
		                <goal>generate</goal>
		            </goals>
		            <configuration>
		                <inputSpec>${project.basedir}/src/main/resources/api/receiver.yaml</inputSpec>
		                <language>spring</language>
		                <configOptions>
		                   <sourceFolder>src/gen/java/main</sourceFolder>
		                </configOptions>
		                <apiPackage>${default.package}.controller</apiPackage>
		                <modelPackage>${default.package}.model</modelPackage>
		                <generateSupportingFiles>false</generateSupportingFiles>
		                <skip>false</skip>
		            </configuration>
		        </execution>
		    </executions>
		</plugin>

I use eclipse as my IDE, and trigger the generation via 'run as' --> 'maven generate-sources'.
I can only found one controller in target folder, which generated from the second 'execution'.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the shown Maven configuration, using administration.yaml and receiver.yaml as the two input specifications, then run Maven generate-sources and inspect the target folder. Trace why only the second execution's controller is present; done means both executions generate their controllers without overwriting or suppressing the first.

Written by the indexing model from the issue text.

Assessment

Tech stack
spring
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.