OpenAPITools / OpenAPITools/openapi-generator

[REQ] Support multiple YAML files for openapi-generator-maven-plugin

Open
#6,379 15 comments 58 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Enhancement: Feature
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

I have a project that needs to use multiple YAML files, but the inputSpec doesn't support this.
I try a workaround solution by adding multiple executions of the maven plugin into the pom, this issue can be temporarily solved.
But in case I need to generate for many more files (YAML1, YAML2, YAML3,...), and in case my execution contains a big block of code like below:

<execution>
	<goals>
		<goal>generate</goal>
	</goals>
	<configuration>
		<inputSpec>${basedir}/api-spec/${swagger.version}/example1.yaml</inputSpec>
		<output>${basedir}</output>
		<templateDirectory>${basedir}/template/${swagger.version}</templateDirectory>
		<additionalProperties>apiVersion=${swagger.version},useApiAnnotation=false</additionalProperties>
		<generateSupportingFiles>false</generateSupportingFiles>
		<generateModelTests>false</generateModelTests>
		<generateApiTests>false</generateApiTests>
		<generateModelDocumentation>false</generateModelDocumentation>
		<generateApiDocumentation>false</generateApiDocumentation>
		<generatorName>jaxrs-spec</generatorName>
		<configOptions>
			<sourceFolder>src/main/java</sourceFolder>
			<implFolder>src/main/java</implFolder>
			<apiPackage>${swagger.api.package}</apiPackage>
			<interfaceOnly>true</interfaceOnly>
			<java8>true</java8>
			<modelPackage>${swagger.model.package}</modelPackage>
			<useSwaggerAnnotations>false</useSwaggerAnnotations>
			<generatePom>false</generatePom>
			<useBeanValidation>false</useBeanValidation>
		</configOptions>
		<typeMappings>
			<typeMapping>Date=String</typeMapping>
			<typeMapping>LocalDate=String</typeMapping>
		</typeMappings>
	</configuration>
</execution>
<execution>
           ..
</execution>
<execution>
           ...
</execution>

The above workaround is not good, can you support us for a feature that supports multiple YAML files?

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 with the openapi-generator-maven-plugin configuration and its inputSpec handling. Define how multiple YAML files should be supplied and what generation behavior is expected, then verify that users no longer need repeated Maven executions for each specification.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, yaml
Domain
build-system, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.