swagger-api / swagger-api/swagger-codegen-generators

ServiceImpl generated in bad package

Open
#892 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
299
Forks
439
PR merge metrics
No merged PRs in 30d

Description

Versions

1.0.25 - swagger-codegen-generators
3.0.25 - swagger-codegen-maven-plugin - generator jaxrs-resteasy-eap

Description

I generate java components from swagger with the jaxrs-resteasy-eap generator using swagger-codegen-maven-plugin maven plugin.
The service implementation file aren't generated in the same package declaration and the project doesn't compile.

Steps to reproduce

  1. Configure the pom file on your project as below :
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.2.0</version>
<executions>
	<execution>
		<id>add-source</id>
		<phase>generate-sources</phase>
		<goals>
			<goal>add-source</goal>
		</goals>
		<configuration>
			<sources>
				<source>src/main/generated-sources</source>
			</sources>
		</configuration>
	</execution>
</executions>
</plugin>

<plugin>
<groupId>io.swagger.codegen.v3</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<version>3.0.25</version>
<dependencies>
	<dependency>
		<groupId>io.swagger.codegen.v3</groupId>
                <artifactId>swagger-codegen-generators</artifactId>
    	        <version>1.0.26-SNAPSHOT</version>
	</dependency>
</dependencies>

<configuration>
	<inputSpec>${project.basedir}/src/main/resources/openapi-demo.yaml</inputSpec>
	<language>jaxrs-resteasy-eap</language>
	<configOptions>
		<sourceFolder>src/main/java</sourceFolder>
		<dateLibrary>java8-localdatetime</dateLibrary>
		<interfaceOnly>false</interfaceOnly>
		<java8>true</java8>
		<library>resteasy</library>
	</configOptions>
	<output>${project.build.directory}/generated-sources</output>
</configuration>
<executions>
	<execution>
		<id>generate-openapi</id>
		<phase>generate-sources</phase>
		<goals>
			<goal>generate</goal>
		</goals>
		<configuration>
			<modelPackage>fr.example.demo.model</modelPackage>
			<apiPackage>fr.example.demo.api</apiPackage>
			<invokerPackage>fr.example.demo</invokerPackage>
			<generateApis>true</generateApis>
			<generateModels>true</generateModels>
			<generateModelDocumentation>false</generateModelDocumentation>
			<generateModelTests>true</generateModelTests>
			<generateSupportingFiles>false</generateSupportingFiles>
			<ignoreFileOverride>${project.basedir}/swagger-codegen-ignore</ignoreFileOverride>
		</configuration>
	</execution>
</executions>
</plugin>
  1. Generate the java code with swagger-codegen-maven-plugin plugin and jaxrs-resteasy-eap generator (mvn clean install on your project)

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

Start by reproducing the generation with the supplied pom configuration, the jaxrs-resteasy-eap generator, and the openapi-demo.yaml input. Inspect the generated ServiceImpl package declaration and compare it with the configured apiPackage; done means the generated project compiles with the implementation in the expected package.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system, tooling
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.