You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/modules/ROOT/pages/index.adoc
+44-64Lines changed: 44 additions & 64 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,10 +24,10 @@ a Gradle plugin based on the link:{oap-api}[openapi-processor-api] to handle any
24
24
[cols="3*",options="header"]
25
25
|===
26
26
| plugin version
27
-
| minimum gradle version
28
-
| minimum java version
27
+
| minimum Gradle version
28
+
| minimum Java version
29
29
30
-
| 2025.x
30
+
| 2026.x, 2025.x
31
31
| 8.2+ with kotlin dsl +
32
32
7.2+ with groovy dsl
33
33
| 17
@@ -42,27 +42,26 @@ a Gradle plugin based on the link:{oap-api}[openapi-processor-api] to handle any
42
42
|
43
43
|===
44
44
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+.
46
46
47
47
48
-
== gradle dsl
48
+
== Gradle dsl
49
49
50
50
An xref:spring:ROOT:index.adoc[openapi-processor-spring] spring specific description is available in xref:spring:ROOT:gradle.adoc[Gradle Integration].
51
51
52
52
The plugin adds a new configuration block `openapiProcessor` to the Gradle project. Each processor is configurable by a nested configuration block.
53
53
54
54
Apart from that there are only two options that are recognized inside the configuration block:
55
55
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.
58
57
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:
60
59
61
60
** `never`, this is the default and disables all update checks.
62
61
** `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.
63
62
** `always`, this will check on any run of Gradle or a processor task if a newer version is available.
64
63
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.
66
65
67
66
[tabs]
68
67
====
@@ -109,7 +108,7 @@ openapiProcessor {
109
108
====
110
109
111
110
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:
113
112
114
113
[tabs]
115
114
====
@@ -191,7 +190,7 @@ spring {
191
190
----
192
191
====
193
192
+
194
-
or like this to use an un-published processor:
193
+
or like this to use an unpublished processor:
195
194
+
196
195
[tabs]
197
196
====
@@ -220,9 +219,9 @@ For example, the java generating processors depend on `openapi-processor-core`.
220
219
+
221
220
[NOTE]
222
221
====
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`.
224
223
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`).
* `apiPath` (optional): the path to the open api YAML file. If set inside a processor configuration it overrides the parent `apiPath`.
250
249
251
250
* `targetDir` (mandatory): the target folder for the processor. The processor will write its output to this directory.
252
251
253
-
* `prop(key, value)` or `prop(Map<String, ?>)` (optional): used to configure processorspecific 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.
254
253
+
255
254
[tabs]
256
255
====
@@ -272,7 +271,7 @@ spring {
272
271
----
273
272
====
274
273
275
-
== gradle tasks
274
+
== Gradle tasks
276
275
277
276
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>`.
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.
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.
348
329
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`.
350
331
351
332
There are two ways to configure it:
352
333
@@ -355,7 +336,7 @@ There are two ways to configure it:
355
336
356
337
=== by path string
357
338
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`:
359
340
360
341
[tabs]
361
342
====
@@ -430,6 +411,8 @@ sourceSets {
430
411
431
412
A preferred approach to avoid `dependsOn` and to support lazy configuration is to use the task output to configure the additional `SourceSet` directories.
432
413
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
+
433
416
[tabs]
434
417
====
435
418
Kotlin::
@@ -446,25 +429,23 @@ sourceSets {
446
429
}
447
430
}
448
431
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"))
456
437
}
438
+
}
457
439
458
-
// if the processor generates java and resource files to the targetDir it is necessary to select the subfolder
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.
485
466
486
467
This way it is not possible to process multiple distinct openapi descriptions with the same processor.
487
468
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()`:
489
470
490
471
[tabs]
491
472
====
@@ -535,19 +516,18 @@ openapiProcessor {
535
516
----
536
517
====
537
518
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`).
539
520
540
521
<2> explicit name of the processor to use.
541
522
542
523
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.
543
525
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.
547
527
548
528
== using plugin snapshots
549
529
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.
551
531
552
532
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.
0 commit comments