OpenAPITools / OpenAPITools/openapi-generator
[REQ] Openapi-generator-maven-plugin using configurationFile only
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Is your feature request related to a problem? Please describe.
I want to make generatorName and inputSpec optional in the mojo if they are defined in a configuration file.
This is to simplify my CI pipelines.
The goal is to have most configuration done in yaml instead of in xml.
Describe the solution you'd like
Ability to use generatorName and inputSpec defined in configurationFile if not present in <configuration> in the pom.xml.
Optionally skip the generation if the configurationFile does not exist.
For example using a parent pom:
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.openapi.generator</groupId>
<artifactId>configuration-file-demo</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>server-api</module>
<module>client-api</module>
<module>typescript-angular</module>
<module>service</module>
</modules>
<build>
<plugins>
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<configuration>
<configurationFile>${project.basedir}/config.yaml</configurationFile>
<skipIfConfigurationFileMissing>true</skipIfConfigurationFileMissing>
</configuration>
<executions>
<execution>
<id>executionId</id>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Each module would contain a config.yaml that triggers the generation.
No other configuration would be needed
For example in server-api folder:
pom.xml
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.openapi.generator</groupId>
<artifactId>configuration-file-demo</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>server-api</artifactId>
<dependencies>
...
</dependencies>
</project>
config.yaml
inputSpec: petstore-on-classpath.yaml
generatorName: spring
Describe alternatives you've considered
Some configuration in xml, some configuration in yaml
Additional context
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 at the Maven plugin's generate goal and its configurationFile handling. Trace how generatorName and inputSpec are currently resolved, then determine how missing configuration should be handled. Done means those values can come from YAML when absent from the POM, with generation optionally skipped when the file is missing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100