TraeckIt :: OpenAPI Validator (maven-plugin)

maven plugin to validate OpenAPI specification files.

License

License

Categories

Categories

Maven Build Tools
GroupId

GroupId

it.traeck.tools.openapi
ArtifactId

ArtifactId

openapi-validator-maven-plugin
Last Version

Last Version

1.0.2
Release Date

Release Date

Type

Type

maven-plugin
Description

Description

TraeckIt :: OpenAPI Validator (maven-plugin)
maven plugin to validate OpenAPI specification files.
Project URL

Project URL

https://github.com/misl/openapi-validator-maven-plugin
Source Code Management

Source Code Management

https://github.com/misl/openapi-validator-maven-plugin

Download openapi-validator-maven-plugin

How to add to project

<plugin>
    <groupId>it.traeck.tools.openapi</groupId>
    <artifactId>openapi-validator-maven-plugin</artifactId>
    <version>1.0.2</version>
</plugin>

Dependencies

compile (6)

Group / Artifact Type Version
org.apache.maven : maven-core jar 3.6.3
org.apache.maven : maven-compat jar 3.6.3
org.apache.maven : maven-plugin-api jar 3.6.3
org.apache.maven.plugin-tools : maven-plugin-annotations jar 3.6.0
io.swagger.parser.v3 : swagger-parser jar 2.0.19
io.swagger.parser.v3 : swagger-parser-v2-converter jar 2.0.19

provided (1)

Group / Artifact Type Version
org.apache.maven : maven-artifact jar 3.6.3

test (1)

Group / Artifact Type Version
org.slf4j : slf4j-simple jar 1.7.30

Project Modules

There are no modules declared in this project.

openapi-validator-maven-plugin

A Maven plugin to support validation of and conversion (YAML vs JSON) to OpenAPI (swagger) files using the Swagger Parser library.

It not only verifies whether the API specification files are valid, but also merges splitted files into a single YAML or JSON file. This is especially usefull where tools can not cope with JSON $ref references to external files.

More info on splitted OpenAPI specification files read Design Web APIs

Usage

Add to your build->plugins section (default phase is generate-sources phase)

<plugin>
  <groupId>it.traeck.tools.openapi</groupId>
  <artifactId>openapi-validator-maven-plugin</artifactId>
  <version>1.0.2</version>
  <executions>
    <execution>
      <goals>
        <goal>generate</goal>
      </goals>
      <configuration>
        <inputSpec>${project.basedir}/src/main/resources/api.yaml</inputSpec>
        <outputPath>${project.build.directory}/generated-specification</outputPath>
        <outputFilename>openapi</outputFilename>
        <outputFormat>JSONANDYAML</outputFormat>
      </configuration>
    </execution>
  </executions>
</plugin>

Followed by:

mvn clean compile

General Configuration parameters

Parameter Description Required Default
inputSpec OpenAPI Spec file path true
outputPath target output path false ${project.build.directory}/generated-specification
outputFilename Output filename (without extension) false openapi
outputFormat Output file format (JSON, YAML, JSONANDYAML) false JSON
encoding encoding to use for output files false ${project.build.sourceEncoding}
prettyPrint whether to pretty print (true) output or not false true

Sample configurations

Please see example configurations for how to use this maven plugin.

Versions

Version
1.0.2
1.0.1
1.0.0