a simple OpenAPI yaml to json generatr.
The openapi generatr gradle plugin is the easiest way to use yaml to json generatr.
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
// ....
}
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 theopenapi.yaml
file and the main input for the generatr. -
targetDir
: (required) the output folder for generating theopenapi.json
file.
See openapi-generatr-spring-mvc-sample
for a complete working sample of a minimal
openapi.yaml.