OpenAPITools / OpenAPITools/openapi-generator
generator "spring" writes sourceFolder property not into generated pom.xml (Batch-Mode)
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Iam using Docker-Image "openapitools/openapi-generator-cli:v5.3.0" for Code-Generation.
Description
I placed theOriginal petstore.yaml in dir:
"~/example/volume/spec-files/petstore.yaml"
Batch-Generation-Config at: "~/example/volume/generator-configs/pestore-server.yaml"
inputSpec: ./volume/spec-files/petstore.yaml
outputDir: ./generated/java/spring/server-demo
generatorName: spring
artifactId: petstore-demo-server
artifactVersion: 0.0.1
groupId: de.demo
additionalProperties:
snapshotVersion: false
useBeanValidation: true
library: spring-boot
sourceFolder: src/gen/java/main
interfaceOnly: true
artifactUrl: https://not-set-demo.de
basePackage: de.demo.server
apiPackage: de.demo.server.api
modelPackage: de.demo.server.model
configPackage: de.demo.server.config
unhandledException: true
hideGenerationTimestamp: true
dateLibrary: java8
serializableModel: true
Steps done with Docker-Container:
Spin up a container in interactive mode with a volume mount to "~/example/volume/" Container-Internally as "/volume"
Open up a Terminal under ~/example/
docker run -it -v "${PWD}/volume:/volume" --entrypoint /bin/bash --rm openapitools/openapi-generator-cli:v5.3.0
In running Container: create a alias for the entrypoint of the generator image.
alias openapi-generator='/usr/local/bin/docker-entrypoint.sh'
In running Container: test if the generator prints out the help information, to see if its working
openapi-generator --help
In running Container: validate your Spec-File
openapi-generator validate -i /volume/spec-files/petstore.yaml
In running Container: Generate-Code
openapi-generator batch ./volume/generator-configs/*.yaml
Result
As Result the code is generated, but the sourceDirectory Tag in generated pom.xml is not set to the value of the Additional-Property -> "sourceFolder: src/gen/java/main".
the default is set here in pom.xml to "src/main/java".
But Dokumentation says that this value should reflect into pom of the generated code.
cat-output of pom.xml
cd /generated/java/spring/server-demo
cat pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>de.demo</groupId>
<artifactId>petstore-demo-server</artifactId>
<packaging>jar</packaging>
<name>petstore-demo-server</name>
<version>0.0.1</version>
<properties>
<java.version>1.8</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<springfox-version>2.9.2</springfox-version>
</properties>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.3.RELEASE</version>
</parent>
<build>
<sourceDirectory>src/main/java</sourceDirectory>
</build>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-commons</artifactId>
</dependency>
<!--SpringFox dependencies -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>${springfox-version}</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${springfox-version}</version>
</dependency>
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>
<dependency>
<groupId>org.openapitools</groupId>
<artifactId>jackson-databind-nullable</artifactId>
<version>0.2.1</version>
</dependency>
<!-- Bean Validation API support -->
<dependency>
<groupId>jakarta.validation</groupId>
<artifactId>jakarta.validation-api</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
</dependencies>
</project>
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
Reproduce the issue with examples/v3.0/petstore.yaml, the batch-generation config, and the spring generator entry point, then inspect the generated pom.xml. Compare the sourceFolder additional property with the generated sourceDirectory and add or update coverage so the configured value is reflected in the pom.xml.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, java, openapi, spring
- Domain
- api, backend, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100