Skip to content

openapi-processor/openapi-processor-json

Repository files navigation

openapi-generatr-json

a simple OpenAPI yaml to json generatr.

Getting Started

The openapi generatr gradle plugin is the easiest way to use yaml to json generatr.

adding generatr-json

The plugin provides a openapiGeneratr dependency configuration that is used to add the generatr dependency.

    dependencies {
        // 'openapiGeneratr' is a custom configuration that is used by the gradle plugin.
        openapiGeneratr 'com.github.hauner.openapi:openapi-generatr-json:1.0.0.M1'
        
        // .... 
        // normal project dependencies
        // .... 
    }

configuring generatr-json

The plugin will add an openapiGeneratr configuration block that is used to configure the generatrs. Configuration for a specific generatr is placed inside it using the generatr name as configuration block name.

    openapiGeneratr {

        json {
            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 generatr.

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

Sample

See openapi-generatr-spring-mvc-sample for a complete working sample of a minimal openapi.yaml.