Skip to content

Commit 10469ad

Browse files
committed
update docs
1 parent 6b4e71d commit 10469ad

File tree

1 file changed

+74
-10
lines changed

1 file changed

+74
-10
lines changed

docs/modules/ROOT/pages/processor/configuration.adoc

Lines changed: 74 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ A mapping yaml looks like this:
99

1010
[source,yaml]
1111
----
12-
openapi-processor-mapping: v9
12+
openapi-processor-mapping: v11
1313
1414
options:
1515
package-name: io.openapiprocessor.sample
@@ -60,7 +60,7 @@ Interfaces and models will be generated into the `api` and `model` subpackages o
6060

6161
[source,yaml]
6262
----
63-
openapi-processor-mapping: v9
63+
openapi-processor-mapping: v11
6464
6565
options:
6666
package-name: io.openapiprocessor.sample
@@ -117,7 +117,7 @@ components:
117117
*mapping.yaml*
118118
[source,yaml]
119119
----
120-
openapi-processor-mapping: v8
120+
openapi-processor-mapping: v11
121121
122122
options:
123123
package-name: io.openapiprocessor.sample
@@ -160,7 +160,7 @@ public class BarResource { // <4>
160160

161161
=== model-type
162162

163-
*optional** (string, `default` or `record`, default is `default`)
163+
**optional** (string, `default` or `record`, default is `default`)
164164

165165
generate pojos (class with get/set property methods) or records model classes from OpenAPI schemas. This is a global setting in the `mapping.yaml`. It can either have the value `default` (which is default) to generate pojos or `record` to generate records.
166166

@@ -169,7 +169,7 @@ generate pojos (class with get/set property methods) or records model classes fr
169169
*mapping.yaml*
170170
[source,yaml]
171171
----
172-
openapi-processor-mapping: v9
172+
openapi-processor-mapping: v11
173173
174174
options:
175175
model-type: record
@@ -219,6 +219,56 @@ public class Foo {
219219
}
220220
----
221221

222+
=== model-accessors ([.badge .badge-since]+new with 2025.1+)
223+
224+
**optional** (boolean, `true` or `false`, default is `true`)
225+
226+
enables or disables generation of accessor methods, i.e. getter and setter. The properties are still private. This is only useful in combination with an object annotation mapping that adds the accessors. For example `lombok.Getter` & `lombok.Setter`.
227+
228+
[NOTE]
229+
This is only used with `model-type: default`. It is ignored with `model-type: record`.
230+
231+
==== example
232+
233+
Here is a small example that uses object annotation mapping to add the lombok getter and setter annotations to the generated class.
234+
235+
[source,yaml]
236+
----
237+
openapi-processor-mapping: v11
238+
239+
options:
240+
package-name: generated
241+
model-type: default # i.e. pojo
242+
model-accessors: false # only used if model-type is default
243+
244+
map:
245+
types:
246+
- type: object @ lombok.Getter
247+
- type: object @ lombok.Setter
248+
----
249+
250+
The generated schema class is then looks like this, with annotations and without accessor methods.
251+
252+
[source,java]
253+
----
254+
package io.openapiprocessor.openapi.model;
255+
256+
import com.fasterxml.jackson.annotation.JsonProperty;
257+
import io.openapiprocessor.openapi.support.Generated;
258+
import java.util.UUID;
259+
import lombok.Getter;
260+
import lombok.Setter;
261+
262+
@Getter
263+
@Setter
264+
@Generated(value = "openapi-processor-spring")
265+
public class Foo {
266+
267+
@JsonProperty("id")
268+
private UUID id;
269+
270+
}
271+
----
222272

223273
=== bean-validation
224274

@@ -239,11 +289,25 @@ to handle the package name change from bean validation v2 to v3 (`javax` => `jak
239289

240290
enables generation of JavaDoc comments from the OpenAPI `description` s on the API interfaces and model pojos.
241291

242-
=== format-code
292+
=== format-code ([.badge .badge-since]+updated with 2025.1+)
293+
294+
// [.badge .badge-since]+changed with 2025.1+
295+
296+
**optional** (boolean, `true` or `false`, `google`, `eclipse` default is `false`)
243297

244-
**optional** (boolean, `true` or `false`, default is `false`)
298+
enable or disable the code formatter.
299+
300+
[source,yaml,opts=novalidate]
301+
----
302+
# mapping.yaml
303+
options:
304+
format-code: false # disable code formatter
305+
format-code: true # use default google code formatter
306+
format-code: google # use google code formatter, i.e. the same as "true"
307+
format-code: eclipse # use eclipse code formatter
308+
----
245309

246-
enable or disable the code formatter. See also xref:oap::jdk.adoc[JDK 16+].
310+
In case of `google` (or `true`) see also xref:oap::jdk.adoc[JDK 16+].
247311

248312
=== one-of-interface
249313

@@ -301,7 +365,7 @@ The other two can be used if `default` does not work.This is described in more d
301365
*mapping.yaml*
302366
[source,yaml]
303367
----
304-
openapi-processor-mapping: v9
368+
openapi-processor-mapping: v11
305369
306370
options:
307371
enum-type: string
@@ -374,7 +438,7 @@ this controls if the `targetDir` is the source root folder or if there is anothe
374438

375439
[source,yaml]
376440
----
377-
openapi-processor-mapping: v9
441+
openapi-processor-mapping: v11
378442
379443
options:
380444
target-dir:

0 commit comments

Comments
 (0)