jlleitschuh
02/13/2017, 3:08 PMval specConfig = configurations.create("spec")
val swaggerOutputDir = "${project.buildDir}/swagger-spec"
val swaggerOutputFile = file("$swaggerOutputDir/swagger.yaml")
configure<CodegenConfigurator> {
inputSpec = file("spec/swagger.yaml").absolutePath
outputDir = swaggerOutputDir
lang = "io.swagger.codegen.languages.SwaggerYamlGenerator"
systemProperties.apply {
// Makes it so that only the one yaml file is generated.
put("apis", "")
}
}
val swaggerYamlTask = tasks.getByName(SwaggerCodeGenPlugin.SWAGGER_TASK) as SwaggerCodeGenTask
val yamlArtifact = mapOf(
"name" to "swagger-spec",
"type" to "yaml",
"extension" to "yaml",
"file" to swaggerOutputFile,
"builtBy" to swaggerYamlTask
)
artifacts.add(specConfig.name, yamlArtifact)