A Maven plugin which processes Swagger documents.
Archived project! This project is archived and will be removed. It has moved here.
With the merge goal you can merge multiple Swagger documents together. The scope
of the merge is limited to the definitions
and paths
elements of the Swagger
definition.
The following example combines two swagger files,
src/main/swagger/address-book.yml
and src/main/swagger/auth.yml
. The result
is stored in target/swagger.yml
.
The plugin supports adding prefixes to definitions and paths in order to avoid clashes.
<plugin>
<groupId>com.github.ngeor</groupId>
<artifactId>yak4j-swagger-maven-plugin</artifactId>
<version>0.9.5</version>
<executions>
<execution>
<id>merge</id>
<goals>
<goal>merge</goal>
</goals>
<configuration>
<inputs>
<input>
<file>src/main/swagger/address-book.yml</file>
<pathPrefix>/address-book</pathPrefix>
<definitionPrefix>AddressBook</definitionPrefix>
</input>
<input>
<file>src/main/swagger/auth.yml</file>
<pathPrefix>/auth</pathPrefix>
<definitionPrefix>Auth</definitionPrefix>
</input>
</inputs>
<output>${project.build.directory}/swagger.yml</output>
</configuration>
</execution>
</executions>
</plugin>
Name | Required | Description |
---|---|---|
inputs | yes | a collection of Swagger files to process |
output | yes | the filename where the resulting Swagger file will be written |
inlineDefinitions | no | a collection of partial Swagger files that will be inlined in the resulting document |
Each input
element has these parameters:
-
file
: the filename where a Swagger file can be read from -
pathPrefix
: all paths will be prefixed with this, in order to prevent clashes.For example, if the Swagger file defines the path
/create
and thepathPrefix
is set to/orders
, the resulting Swagger file will have a path/orders/create
. -
definitionPrefix
: all definitions (models) will be prefixed with this, in order to prevent clashes.For example, if the Swagger file defines the model
Address
and thedefinitionPrefix
is set toOrder
, then the resulting definition will beOrderAddress
.