Skip to content

Commit 0a793c2

Browse files
committed
docs: updated, clean up
1 parent e185b26 commit 0a793c2

1 file changed

Lines changed: 44 additions & 64 deletions

File tree

docs/modules/ROOT/pages/index.adoc

Lines changed: 44 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ a Gradle plugin based on the link:{oap-api}[openapi-processor-api] to handle any
2424
[cols="3*",options="header"]
2525
|===
2626
| plugin version
27-
| minimum gradle version
28-
| minimum java version
27+
| minimum Gradle version
28+
| minimum Java version
2929

30-
| 2025.x
30+
| 2026.x, 2025.x
3131
| 8.2+ with kotlin dsl +
3232
7.2+ with groovy dsl
3333
| 17
@@ -42,27 +42,26 @@ a Gradle plugin based on the link:{oap-api}[openapi-processor-api] to handle any
4242
|
4343
|===
4444

45-
NOTE: In case the generated source should be formatted with google code format, it is necessary to configure a few xref:oap::jdk.adoc[additional jvm parameter] to make google code format work when running the processor with JDK 16+.
45+
NOTE: In case the generated source should be formatted with google code format, it is necessary to configure a few xref:oap::jdk.adoc[additional jvm parameters] to make google code format work when running the processor with JDK 16+.
4646

4747

48-
== gradle dsl
48+
== Gradle dsl
4949

5050
An xref:spring:ROOT:index.adoc[openapi-processor-spring] spring specific description is available in xref:spring:ROOT:gradle.adoc[Gradle Integration].
5151

5252
The plugin adds a new configuration block `openapiProcessor` to the Gradle project. Each processor is configurable by a nested configuration block.
5353

5454
Apart from that there are only two options that are recognized inside the configuration block:
5555

56-
* `apiPath`, which defines the path to the openapi YAML file. This is usually the same for all
57-
processors and placing it directly into the `openapiProcessor` block sets it for all processors.
56+
* `apiPath`, which defines the path to the openapi YAML file. This is usually the same for all processors and placing it directly into the `openapiProcessor` block sets it for all processors.
5857

59-
* `checkUpdates`, which allows to enable a version check for the Gradle plugin itself and any processor that supports a version check. It can have one of 3 values:
58+
* `checkUpdates`, which allows enabling a version check for the Gradle plugin itself and any processor that supports a version check. It can have one of three values:
6059

6160
** `never`, this is the default and disables all update checks.
6261
** `daily`, this will check once a day if there is a newer version available. The plugin remembers the last check by writing a timestamp to `build/openapiprocessor/<processor>.yaml`. Without that file the check will run, e.g. after a clean checkout or after running the `clean` task.
6362
** `always`, this will check on any run of Gradle or a processor task if a newer version is available.
6463

65-
To configure a processor, for example xref:spring:ROOT:index.adoc[openapi-processor-spring], place a `spring` configuration into the `openapiProcessor` block. The name of the configuration is used to create a Gradle task `process<Name>` to run the corresponding processor.
64+
To configure a processor, for example, xref:spring:ROOT:index.adoc[openapi-processor-spring], place a `spring` configuration into the `openapiProcessor` block. The name of the configuration is used to create a Gradle task `process<Name>` to run the corresponding processor.
6665

6766
[tabs]
6867
====
@@ -109,7 +108,7 @@ openapiProcessor {
109108
====
110109

111110

112-
In case another processor (e.g. JSON) is required place its configuration into the `openapiProcessor` block in the same way:
111+
In case another processor (e.g., JSON) is required place its configuration into the `openapiProcessor` block in the same way:
113112

114113
[tabs]
115114
====
@@ -191,7 +190,7 @@ spring {
191190
----
192191
====
193192
+
194-
or like this to use an un-published processor:
193+
or like this to use an unpublished processor:
195194
+
196195
[tabs]
197196
====
@@ -220,9 +219,9 @@ For example, the java generating processors depend on `openapi-processor-core`.
220219
+
221220
[NOTE]
222221
====
223-
To find 'SNAPSHOT' versions the plugin automatically adds the snapshot repository to the `repositories`.
222+
To find 'SNAPSHOT' versions, the plugin automatically adds the snapshot repository to the `repositories`.
224223
225-
[.badge .badge-since]+since 2022.2+ In case you don't want this it is possible to disable adding the snapshot repository by adding `openapi-processor-gradle.snapshots = false` to `gradle.properties`).
224+
[.badge .badge-since]+since 2022.2+ In case you don't want this, it is possible to disable adding the snapshot repository by adding `openapi-processor-gradle.snapshots = false` to `gradle.properties`).
226225
====
227226
+
228227
[tabs]
@@ -232,25 +231,25 @@ Kotlin::
232231
[source,kotlin]
233232
----
234233
process("spring") {
235-
processor("io.openapiprocessor:openapi-processor-core:2021.3-SNAPSHOT")
236-
processor("io.openapiprocessor:openapi-processor-spring:2021.1")
234+
processor("io.openapiprocessor:openapi-processor-core:2026.3-SNAPSHOT")
235+
processor("io.openapiprocessor:openapi-processor-spring:2026.2")
237236
}
238237
----
239238
Groovy::
240239
+
241240
[source,groovy]
242241
----
243242
spring {
244-
processor 'io.openapiprocessor:openapi-processor-core:2021.3-SNAPSHOT'
245-
processor 'io.openapiprocessor:openapi-processor-spring:2021.1'
243+
processor 'io.openapiprocessor:openapi-processor-core:2026.3-SNAPSHOT'
244+
processor 'io.openapiprocessor:openapi-processor-spring:2026.2'
246245
}
247246
----
248247
====
249248
* `apiPath` (optional): the path to the open api YAML file. If set inside a processor configuration it overrides the parent `apiPath`.
250249

251250
* `targetDir` (mandatory): the target folder for the processor. The processor will write its output to this directory.
252251

253-
* `prop(key, value)` or `prop(Map<String, ?>)` (optional): used to configure processor specific options. It just fills a map that is passed to the processor. It is not needed in a groovy dsl which automatically adds any unknown property to the processor options map.
252+
* `prop(key, value)` or `prop(Map<String, ?>)` (optional): used to configure processor-specific options. It just fills a map passed to the processor. It is unnecessary in a groovy dsl which automatically adds any unknown property to the processor options map.
254253
+
255254
[tabs]
256255
====
@@ -272,7 +271,7 @@ spring {
272271
----
273272
====
274273

275-
== gradle tasks
274+
== Gradle tasks
276275

277276
The plugin creates a single Gradle task for each processor configuration that will run the corresponding processor. By default, the name gets derived from the name of the processor: `process<Name>`.
278277

@@ -323,30 +322,12 @@ compileJava.dependsOn ('processSpring')
323322
----
324323
====
325324

326-
==== using the task name
327-
328-
The Gradle plugin creates the processing tasks inside an `afterEvaluate` block (because its name is configurable). To directly use its name, like in the example below, the configuration needs to be in an `afterEvaluate` block.
329-
330-
[source,groovy]
331-
----
332-
// groovy
333-
tasks.register('prepareProcessing') {
334-
doLast {
335-
println 'preparing processing...'
336-
}
337-
}
338-
339-
afterEvaluate {
340-
tasks.processSpring.dependsOn('prepareProcessing')
341-
}
342-
----
343-
344325
[#_using_the_task_output]
345326
== using the task output
346327

347-
In case the processor creates java sources it is necessary to compile them as part of the build process.
328+
In case the processor creates Java sources, it is necessary to compile them as part of the build process.
348329

349-
To compile the java source files created by openapi-processor-spring add the `targetDir` of the processor to the java `sourceSets`.
330+
To compile the Java source files created by openapi-processor-spring, add the `targetDir` of the processor to the java `sourceSets`.
350331

351332
There are two ways to configure it:
352333

@@ -355,7 +336,7 @@ There are two ways to configure it:
355336

356337
=== by path string
357338

358-
Using a path string it is simply added as an additional `srcDir`:
339+
Using a path string, it is simply added as an additional `srcDir`:
359340

360341
[tabs]
361342
====
@@ -430,6 +411,8 @@ sourceSets {
430411

431412
A preferred approach to avoid `dependsOn` and to support lazy configuration is to use the task output to configure the additional `SourceSet` directories.
432413

414+
NOTE: [.badge .badge-since]+since 2026.1+ In previous versions, it was necessary to use an `afterEvaluate` block to access the processor tasks. This is no longer necessary.
415+
433416
[tabs]
434417
====
435418
Kotlin::
@@ -446,25 +429,23 @@ sourceSets {
446429
}
447430
}
448431
449-
afterEvaluate {
450-
// if the processor generates java files only, directly to targetDir
451-
main {
452-
java {
453-
// add generated files
454-
srcDir(tasks.named("processSpring"))
455-
}
432+
// if the processor generates java files only, directly to targetDir
433+
main {
434+
java {
435+
// add generated files
436+
srcDir(tasks.named("processSpring"))
456437
}
438+
}
457439
458-
// if the processor generates java and resource files to the targetDir it is necessary to select the subfolder
459-
main {
460-
java {
461-
// add generated files
462-
srcDir(tasks.named<OpenApiProcessorTask>("processSpring").map { it.getTargetDir().dir("java") })
463-
}
464-
resources {
465-
// add generated resources
466-
srcDir(tasks.named<OpenApiProcessorTask>("processSpring").map { it.getTargetDir().dir("resources") })
467-
}
440+
// if the processor generates java and resource files to the targetDir it is necessary to select the subfolder
441+
main {
442+
java {
443+
// add generated files
444+
srcDir(tasks.named<OpenApiProcessorTask>("processSpring").map { it.getTargetDir().dir("java") })
445+
}
446+
resources {
447+
// add generated resources
448+
srcDir(tasks.named<OpenApiProcessorTask>("processSpring").map { it.getTargetDir().dir("resources") })
468449
}
469450
}
470451
}
@@ -481,11 +462,11 @@ sourceSets {
481462

482463
//[.badge .badge-since]+since 2022.1+
483464

484-
By default, the name of a `processor` configuration block is used to select the processor library. Each processor library has a name and the plugin tries to load the processor library with that name.
465+
By default, the name of a `processor` configuration block is used to select the processor library. Each processor library has a name, and the plugin tries to load the processor library with that name.
485466

486467
This way it is not possible to process multiple distinct openapi descriptions with the same processor.
487468

488-
To achieve this it is possible to use user selected names for the `processor` blocks and explicitly configure the processor name using `processorName()`:
469+
To achieve this, it is possible to use user selected names for the `processor` blocks and explicitly configure the processor name using `processorName()`:
489470

490471
[tabs]
491472
====
@@ -535,19 +516,18 @@ openapiProcessor {
535516
----
536517
====
537518

538-
<1> user selected name for the configuration. It is used to create the task name (in this case `processApiOne` & `processApiTwo`).
519+
<1> a user selected name for the configuration. It is used to create the task name (in this case `processApiOne` & `processApiTwo`).
539520

540521
<2> explicit name of the processor to use.
541522

542523

524+
The plugin configures the parent directory of the openapi file (i.e. `apiPath`) and the `targetDir` for the up-to-date check of each `processXX` gradle task. If the inputs and outputs are unchanged, Gradle will not re-run the task.
543525

544-
The plugin configures the parent directory of the openapi file (i.e. `apiPath`) and the `targetDir` for the up-to-date check of each `processXX` gradle task. If the inputs and outputs are unchanged Gradle will not re-run the task.
545-
546-
To keep this working and to avoid unnecessary re-runs of the processor tasks it is recommended to use distinct folders for each api file.
526+
To keep this working and to avoid unnecessary re-runs of the processor tasks, it is recommended to use distinct folders for each api file.
547527

548528
== using plugin snapshots
549529

550-
Sometimes it is useful to try a special plugin version instead of the published plugin from the plugin portal. For example to try a snapshot or test version of the plugin.
530+
Sometimes it is useful to try a special plugin version instead of the published plugin from the plugin portal. For example, to try a snapshot or test version of the plugin.
551531

552532
This is possible by configuring the repositories checked for plugins using a `pluginManagement` block in `settings.gradle` (this must be at the top of the file). The example below adds the snapshot repository of the Gradle plugin.
553533

0 commit comments

Comments
 (0)