openapi-processor-json

badge License Apache%202.0 blue

a simple OpenAPI yaml to json converter. May be useful to feed the OpenAPI to an api viewer like Swagger UI.

Getting Started

The openapi-processor-gradle gradle is the easiest way to use the yaml to json processor.

configuring gradle

The gradle plugin will add an openapiProcessor configuration block that is used to configure the openapi processors. Configuration for a specific processor is going inside it with the processor name (in this case json) as the configuration block name.

openapiProcessor {

    json {
        processor 'com.github.hauner.openapi:openapi-processor-json:1.0.0.M4'

        apiPath = "$projectDir/src/api/openapi.yaml"
        targetDir = "$projectDir/build/openapi"
    }

}
  • apiPath: (required) the path to the openapi.yaml file and the main input for the processor.

  • targetDir: (required) the output folder for generating the openapi.json file.

Samples

See spring mvc sample or spring webflux sample for a complete working spring boot sample with a minimal openapi.yaml.