forked from loafle/openapi-generator-original
[gradle] Clarify defining multiple tasks (#5167)
This commit is contained in:
@@ -9,7 +9,6 @@ These map almost fully 1:1 with the options you'd pass to the CLI or Maven plugi
|
||||
|
||||
Tasks are listed under the "OpenAPI Tools" tasks heading.
|
||||
|
||||
|
||||
.OpenAPI Tools Tasks
|
||||
|===
|
||||
|task name |description
|
||||
@@ -38,6 +37,30 @@ compileJava.dependsOn tasks.openApiGenerate
|
||||
```
|
||||
====
|
||||
|
||||
All extensions can be rewritten as tasks. Where you can have only a single extension defined in your gradle file, you may have multiple tasks.
|
||||
|
||||
.One Extension, multiple tasks
|
||||
[source,groovy]
|
||||
----
|
||||
// Validating a single specification
|
||||
openApiValidate {
|
||||
inputSpec = "$rootDir/petstore-v3.0-invalid.yaml".toString()
|
||||
}
|
||||
|
||||
// Define a task for validating one specification
|
||||
task validateGoodSpec(type: org.openapitools.generator.gradle.plugin.tasks.ValidateTask){
|
||||
inputSpec = "$rootDir/petstore-v3.0.yaml".toString()
|
||||
}
|
||||
|
||||
// Define a task for validating another specification
|
||||
task validateBadSpec(type: org.openapitools.generator.gradle.plugin.tasks.ValidateTask){
|
||||
inputSpec = "$rootDir/petstore-v3.0-invalid.yaml".toString()
|
||||
}
|
||||
|
||||
// Define a task for batch validations
|
||||
task validateSpecs(dependsOn: ['validateGoodSpec', 'validateBadSpec'])
|
||||
----
|
||||
|
||||
== Plugin Setup
|
||||
|
||||
//# RELEASE_VERSION
|
||||
|
||||
@@ -91,3 +91,13 @@ task generateGoWithInvalidSpec(type: org.openapitools.generator.gradle.plugin.ta
|
||||
dateLibrary: "threetenp"
|
||||
]
|
||||
}
|
||||
|
||||
task validateGoodSpec(type: org.openapitools.generator.gradle.plugin.tasks.ValidateTask){
|
||||
inputSpec = "$rootDir/petstore-v3.0.yaml".toString()
|
||||
}
|
||||
|
||||
task validateBadSpec(type: org.openapitools.generator.gradle.plugin.tasks.ValidateTask){
|
||||
inputSpec = "$rootDir/petstore-v3.0-invalid.yaml".toString()
|
||||
}
|
||||
|
||||
task validateSpecs(dependsOn: ['validateGoodSpec', 'validateBadSpec'])
|
||||
|
||||
Reference in New Issue
Block a user