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:2021.2'
apiPath = "$projectDir/src/api/openapi.yaml"
targetDir = "$projectDir/build/openapi"
}
}
-
apiPath
: (required) the path to theopenapi.yaml
file and the main input for the processor. -
targetDir
: (required) the output folder for generating theopenapi.json
file.
Samples
See spring mvc sample or spring webflux sample for a complete working spring boot sample with a minimal openapi.yaml.