Issue #15095: Improve gradle task documentation (#15193)

Co-authored-by: Steven <steven.goris@nike.com>
This commit is contained in:
Steven Goris 2023-04-12 05:38:09 +02:00 committed by GitHub
parent ff48f80379
commit 0b41ee1c78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -96,14 +96,14 @@ This gives access to the following tasks:
> The plugin implements the above tasks as project extensions of the same name. If youd like to declare these tasks as dependencies to other tasks (using `dependsOn`), youll need a task reference. e.g.: > The plugin implements the above tasks as project extensions of the same name. If youd like to declare these tasks as dependencies to other tasks (using `dependsOn`), youll need a task reference. e.g.:
> ```groovy > ```groovy
> compileJava.dependsOn tasks.openApiGenerate > compileJava.dependsOn tasks.named("openApiGenerate")
> ``` > ```
For full details of all options, see the [plugin README](https://github.com/OpenAPITools/openapi-generator/tree/master/modules/openapi-generator-gradle-plugin). For full details of all options, see the [plugin README](https://github.com/OpenAPITools/openapi-generator/tree/master/modules/openapi-generator-gradle-plugin).
### Example ### Example
An example task for generating a kotlin client: An example openApiGenerate task configuration for generating a kotlin client:
```groovy ```groovy
openApiGenerate { openApiGenerate {
@ -113,8 +113,10 @@ openApiGenerate {
apiPackage = "org.openapi.example.api" apiPackage = "org.openapi.example.api"
invokerPackage = "org.openapi.example.invoker" invokerPackage = "org.openapi.example.invoker"
modelPackage = "org.openapi.example.model" modelPackage = "org.openapi.example.model"
configOptions = [ configOptions.putAll([
dateLibrary: "java8" dateLibrary: "java8"
] ])
} }
``` ```
*If you want to create separate tasks (for example when you have more than one api spec and require different parameters for each), this is how to do so in Gradle 7+: `tasks.register('taskName', org.openapitools.generator.gradle.plugin.tasks.GenerateTask) { ... }`.*