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/processor/configuration.adoc
+66-4Lines changed: 66 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,15 +8,16 @@ A mapping yaml looks like this:
8
8
9
9
[source,yaml]
10
10
----
11
-
openapi-processor-mapping: v3
11
+
openapi-processor-mapping: v4
12
12
13
13
options:
14
14
package-name: io.openapiprocessor.sample
15
15
model-name-suffix: Resource
16
+
model-type: record
16
17
one-of-interface: true
17
18
bean-validation: jakarta
18
19
generated-date: true
19
-
format-code: false
20
+
format-code: true
20
21
javadoc: true
21
22
22
23
map:
@@ -36,6 +37,8 @@ Interfaces and models will be generated into the `api` and `model` subpackages o
36
37
37
38
* `model-suffix-name` (**optional**, default is empty). See xref:_model_name_suffix[below].
38
39
40
+
* `model-type` (*optional**, `default` or `record`, default is `default`). Generate pojos (class with get/set property methods) or records model classes from OpenAPI schemas. See xref:_model_type[below].
41
+
39
42
* `bean-validation` (**optional**, `true` or `false`, `javax`, `jakarta`) enables generation of bean validation annotations. Default is `false`. See link:{bean-validation}[Bean Validation Specification, window="_blank"].
40
43
+
41
44
With the [.badge .badge-since]+2023.1+ releases this key allows two new values to handle the package name change from bean validation v2 to v3 (`javax` => `jakarta`).
@@ -45,9 +48,9 @@ With the [.badge .badge-since]+2023.1+ releases this key allows two new values t
45
48
** `javax`: enables bean validation annotations v2, with `javax` package name
46
49
** `jakarta`: enables bean validation annotations v3, with `jakarta` package name
47
50
48
-
* `javadoc` (**optional**, `true` or `false`) enables generation of JavaDoc comments from the OpenAPI `description` s on the API interfaces and model pojos.Default is `false`.This is still experimental.
51
+
* `javadoc` (**optional**, `true` or `false`) enables generation of JavaDoc comments from the OpenAPI `description` s on the API interfaces and model pojos.Default is `false`.
49
52
50
-
* `format-code` (**optional**, `true` or `false`) enable or disable the code formatter: Default is `true`.
53
+
* `format-code` (**optional**, `true` or `false`) enable or disable the code formatter: Default is `false`.
51
54
52
55
* `one-of-interface` (**optional**, `true` or `false`) enables generation of marker interfaces for `oneOf` objects. See xref:processor/one-of-interface.adoc#_marker_interfaces[oneOf marker interfaces].
53
56
@@ -145,6 +148,65 @@ public class BarResource { // <4>
145
148
<3> the class name of the `Foo` schema got the configured `Resource` suffix
146
149
<4> the class name of the `BarResource` is identical to the original schema name. Since the existing suffix is equal to `model-name-suffix` it is ignored. Otherwise, This prevents funny class names like `BarResourceResource`.
147
150
151
+
[#_model_type]
152
+
=== model type:
153
+
154
+
(*optional**, `default` or `record`, default is `default`)
155
+
156
+
openapi-processor is now capable of generating java `record`s instead of pojos for 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.
157
+
158
+
*mapping.yaml*
159
+
[source,yaml]
160
+
----
161
+
openapi-processor-mapping: v4
162
+
163
+
options:
164
+
model-type: record
165
+
----
166
+
167
+
With `model-type: record` the processor will generate `record` s like this:
0 commit comments