File tree Expand file tree Collapse file tree
modules/openapi-generator-gradle-plugin Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,7 +9,6 @@ These map almost fully 1:1 with the options you'd pass to the CLI or Maven plugi
99
1010Tasks are listed under the "OpenAPI Tools" tasks heading.
1111
12-
1312.OpenAPI Tools Tasks
1413|===
1514|task name |description
@@ -38,6 +37,30 @@ compileJava.dependsOn tasks.openApiGenerate
3837```
3938====
4039
40+ 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.
41+
42+ .One Extension, multiple tasks
43+ [source,groovy]
44+ ----
45+ // Validating a single specification
46+ openApiValidate {
47+ inputSpec = "$rootDir/petstore-v3.0-invalid.yaml".toString()
48+ }
49+
50+ // Define a task for validating one specification
51+ task validateGoodSpec(type: org.openapitools.generator.gradle.plugin.tasks.ValidateTask){
52+ inputSpec = "$rootDir/petstore-v3.0.yaml".toString()
53+ }
54+
55+ // Define a task for validating another specification
56+ task validateBadSpec(type: org.openapitools.generator.gradle.plugin.tasks.ValidateTask){
57+ inputSpec = "$rootDir/petstore-v3.0-invalid.yaml".toString()
58+ }
59+
60+ // Define a task for batch validations
61+ task validateSpecs(dependsOn: ['validateGoodSpec', 'validateBadSpec'])
62+ ----
63+
4164== Plugin Setup
4265
4366//# RELEASE_VERSION
Original file line number Diff line number Diff line change @@ -91,3 +91,13 @@ task generateGoWithInvalidSpec(type: org.openapitools.generator.gradle.plugin.ta
9191 dateLibrary : " threetenp"
9292 ]
9393}
94+
95+ task validateGoodSpec (type : org.openapitools.generator.gradle.plugin.tasks.ValidateTask ){
96+ inputSpec = " $rootDir /petstore-v3.0.yaml" . toString()
97+ }
98+
99+ task validateBadSpec (type : org.openapitools.generator.gradle.plugin.tasks.ValidateTask ){
100+ inputSpec = " $rootDir /petstore-v3.0-invalid.yaml" . toString()
101+ }
102+
103+ task validateSpecs (dependsOn : [' validateGoodSpec' , ' validateBadSpec' ])
You can’t perform that action at this time.
0 commit comments