Skip to content

Commit bff3783

Browse files
committed
1 parent bf350c4 commit bff3783

File tree

5 files changed

+543
-1
lines changed

5 files changed

+543
-1
lines changed

openapi-processor-core/src/main/kotlin/io/openapiprocessor/core/converter/OptionsConverter.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ class OptionsConverter(private val checkObsoleteProcessorOptions: Boolean = fals
7171
options.javadoc = mapping.options.javadoc
7272
options.oneOfInterface = mapping.options.oneOfInterface
7373
options.formatCode = mapping.options.formatCode
74+
options.generatedAnnotation = mapping.options.generatedAnnotation
7475
options.generatedDate = mapping.options.generatedDate
7576

7677
with(mapping.compatibility) {

openapi-processor-core/src/main/kotlin/io/openapiprocessor/core/processor/mapping/v2/Options.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ data class Options(
6262
*/
6363
val formatCode: Boolean = false,
6464

65+
/**
66+
* enable/disable the @Generated annotation (optional)
67+
*/
68+
val generatedAnnotation: Boolean = true,
69+
6570
/**
6671
* enable/disable the @Generated date (optional)
6772
*/
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
##
2+
## mapping example with keys & values
3+
##
4+
5+
# mapping format [required]
6+
openapi-processor-mapping: v8
7+
8+
options: # general processor options [required]
9+
10+
# target package [required]: io.openapiprocessor.generated (default)
11+
package-name: io.openapiprocessor.generated
12+
13+
# validation annotation (optional): true or false (default), javax, jakarta.
14+
bean-validation: jakarta
15+
16+
# generate javadoc from OpenAPI 'description' properties.
17+
javadoc: true
18+
19+
# enable/disable code formatter: true (default) or false.
20+
format-code: false
21+
22+
# suffix for model class names and enum names. Default is none.
23+
model-name-suffix: Resource
24+
25+
# default (i.e pojo) or record
26+
model-type: default
27+
28+
# default, string, supplier
29+
enum-type: default
30+
31+
# generate common interface for an `oneOf` object list (optional): true or false (default)
32+
one-of-interface: true
33+
34+
# enable/disable deletion of targetDir: true (default) or false.
35+
clear-target-dir: false
36+
37+
# enable/disable @Generated annotation
38+
generated-annotation: true
39+
40+
# enable/disable date on @Generated annotation
41+
generated-date: true
42+
43+
44+
45+
compatibility:
46+
bean-validation-valid-on-reactive: false
47+
identifier-word-break-from-digit-to-letter: false
48+
49+
map: # the type mappings
50+
51+
# global mappings, apply to all paths/endpoints
52+
53+
# response wrapper (optional)
54+
result: org.springframework.http.ResponseEntity
55+
56+
# result style (optional, default "success")
57+
result-style: all
58+
59+
# reactive single wrapper (optional)
60+
single: reactor.core.publisher.Mono
61+
62+
# reactive array wrapper (optional)
63+
multi: reactor.core.publisher.Flux
64+
65+
types: # global type mappings (optional)
66+
67+
- type: array => java.util.Collection
68+
69+
- type: Schema => java.util.Map
70+
generics:
71+
- java.lang.String
72+
- java.lang.Double
73+
74+
- type: Schema @ io.openapiprocessor.Annotation()
75+
76+
parameters: # global parameter mappings (optional)
77+
78+
- name: foo => java.util.List
79+
- name: bar => com.github.hauner.openapi.Bar
80+
- name: param @ io.openapiprocessor.Annotation()
81+
- type: Schema @ io.openapiprocessor.Annotation()
82+
83+
responses: # global response mappings (optional)
84+
85+
- content: application/vnd.something => java.util.List
86+
- content: application/json => com.github.hauner.openapi.FooBar
87+
88+
89+
paths: # path/endpoint specific mappings (optional)
90+
91+
/first: # a path/endpoint from the openapi.yaml
92+
93+
# generate endpoint to a separate "excluded" interface
94+
exclude: true
95+
96+
/second: # another path/endpoint from the openapi.yaml
97+
98+
# path mappings, allow the same mappings as on the global level (except the "paths" property)
99+
# all mappings apply only to the parent path overriding any matching global mapping
100+
101+
# override top level "result" property, "plain" means no wrapper
102+
result: plain
103+
single: reactor.core.publisher.Mono
104+
multi: reactor.core.publisher.Flux
105+
106+
types:
107+
- type: Schema => java.util.Collection
108+
109+
parameters:
110+
- name: foo => java.util.List
111+
- add: bar => java.util.Set
112+
- type: Schema @ io.openapiprocessor.Annotation()
113+
114+
responses:
115+
- content: application/vnd.any => java.util.Set
116+
- content: application/json => java.util.Map
117+
118+
/third:
119+
result: plain
120+
121+
# path mappings can be limited to a specific http method
122+
123+
patch:
124+
# path method mappings, allow the same mappings as on the global level (except the "paths" property)
125+
# all mappings apply only to the parent path and method overriding any matching global mapping
126+
127+
null: org.openapitools.jackson.nullable.JsonNullable = JsonNullable.undefined()
128+
129+
extensions:
130+
x-something: foo @ some.Annotation
131+
x-something-else:
132+
- foo @ some.custom.FooAnnotation
133+
- bar @ some.custom.BarAnnotation

0 commit comments

Comments
 (0)