Skip to content

Commit f879bdf

Browse files
committed
docs
1 parent 4b5730d commit f879bdf

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed

docs/modules/ROOT/pages/index.adoc

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,76 @@ sourceSets {
375375
----
376376
====
377377

378+
== processing multiple openapi files
379+
380+
[.badge .badge-since]+since 2022.1+
381+
382+
NOTE: this is experimental
383+
384+
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.
385+
386+
This way it is not possible to process multiple distinct openapi descriptions with the same processor.
387+
388+
To achieve this it is possible to use user selected names for the `processor` blocks and explicitly configure the processor name using `processorName()`:
389+
390+
[tabs]
391+
====
392+
Groovy::
393+
+
394+
[source,groovy]
395+
----
396+
// build.gradle
397+
398+
openapiProcessor {
399+
apiOne { // <1>
400+
processorName "spring" // <2>
401+
402+
apiPath "${projectDir}/src/api-one/openapi.yaml"
403+
... options of openapi-processor-spring
404+
}
405+
406+
apiTwo { // <1>
407+
processorName "spring" // <2>
408+
409+
apiPath "${projectDir}/src/api-two/openapi.yaml"
410+
... options of openapi-processor-spring
411+
}
412+
}
413+
----
414+
Kotlin::
415+
+
416+
[source,kotlin]
417+
----
418+
// build.gradle.kts
419+
420+
openapiProcessor {
421+
process("apiOne") { // <1>
422+
processorName("spring") // <2>
423+
424+
apiPath("${projectDir}/src/api-one/openapi.yaml")
425+
... options of openapi-processor-spring
426+
}
427+
428+
process("apiTwo") { // <1>
429+
processorName("spring") // <2>
430+
431+
apiPath("${projectDir}/src/api-two/openapi.yaml")
432+
... options of openapi-processor-json
433+
}
434+
}
435+
----
436+
====
437+
438+
<1> user selected name for the configuration. It is used to create the task name (in this case `processApiOne` & `processApiTwo`).
439+
440+
<2> explicit name of the processor to use.
441+
442+
443+
444+
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.
445+
446+
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.
447+
378448
== configuration example
379449

380450
Here is a full example that configures xref:spring:ROOT:index.adoc[openapi-processor-spring] and xref:json:ROOT:index.adoc[openapi-processor-json]:

0 commit comments

Comments
 (0)