Skip to content

Commit 54bf95d

Browse files
committed
default REFACTOR_ALLOF_WITH_PROPERTIES_ONLY to true
1 parent 01139e6 commit 54bf95d

File tree

164 files changed

+2686
-1707
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

164 files changed

+2686
-1707
lines changed

docs/customization.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,7 @@ OpenAPI Normalizer transforms the input OpenAPI doc/spec (which may not perfectl
538538
539539
- SIMPLIFY_ONEOF_ANYOF
540540
- SIMPLIFY_BOOLEAN_ENUM
541+
- REFACTOR_ALLOF_WITH_PROPERTIES_ONLY
541542
542543
(One can use `DISABLE_ALL=true` to disable all the rules)
543544

modules/openapi-generator/src/main/java/org/openapitools/codegen/OpenAPINormalizer.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ public OpenAPINormalizer(OpenAPI openAPI, Map<String, String> inputRules) {
211211
rules.put(SIMPLIFY_ONEOF_ANYOF, true);
212212
rules.put(SIMPLIFY_BOOLEAN_ENUM, true);
213213
rules.put(SIMPLIFY_ONEOF_ANYOF_ENUM, true);
214+
rules.put(REFACTOR_ALLOF_WITH_PROPERTIES_ONLY, true);
214215

215216
processRules(inputRules);
216217

modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4812,7 +4812,7 @@ public void testMultiInheritanceParentRequiredParams_issue16797() throws IOExcep
48124812
// super(responseType, requestId, success, pageInfo);
48134813
// }
48144814
JavaFileAssert.assertThat(output.get("Object4.java"))
4815-
.assertConstructor("Type1", "String", "String", "Boolean")
4815+
.assertConstructor("String", "String", "Boolean", "Type1")
48164816
.hasParameter("responseType").toConstructor()
48174817
.hasParameter("requestId").toConstructor()
48184818
.hasParameter("success").toConstructor()

samples/client/others/java/webclient-sealedInterface/api/openapi.yaml

Lines changed: 79 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -129,17 +129,20 @@ components:
129129
allOf:
130130
- $ref: "#/components/schemas/Addressable"
131131
- $ref: "#/components/schemas/Extensible"
132-
description: Entity reference schema to be use for all entityRef class.
132+
- description: Entity reference schema to be use for all entityRef class.
133+
properties:
134+
name:
135+
description: Name of the related entity.
136+
type: string
137+
'@referredType':
138+
description: The actual type of the target instance when needed for disambiguation.
139+
type: string
140+
type: object
141+
example: null
133142
discriminator:
134143
propertyName: '@type'
135-
properties:
136-
name:
137-
description: Name of the related entity.
138-
type: string
139-
'@referredType':
140-
description: The actual type of the target instance when needed for disambiguation.
141-
type: string
142144
type: object
145+
example: null
143146
FooRefOrValue:
144147
discriminator:
145148
propertyName: '@type'
@@ -151,58 +154,82 @@ components:
151154
Foo:
152155
allOf:
153156
- $ref: "#/components/schemas/Entity"
157+
- properties:
158+
fooPropA:
159+
type: string
160+
fooPropB:
161+
type: string
162+
type: object
163+
example: null
154164
example:
165+
'@baseType': '@baseType'
166+
'@type': '@type'
155167
fooPropA: fooPropA
168+
href: href
169+
id: id
156170
fooPropB: fooPropB
157-
properties:
158-
fooPropA:
159-
type: string
160-
fooPropB:
161-
type: string
171+
'@schemaLocation': '@schemaLocation'
162172
type: object
163173
FooRef:
164174
allOf:
165175
- $ref: "#/components/schemas/EntityRef"
166-
properties:
167-
foorefPropA:
168-
type: string
176+
- properties:
177+
foorefPropA:
178+
type: string
179+
type: object
180+
example: null
169181
type: object
182+
example: null
170183
BarRef:
171184
allOf:
172185
- $ref: "#/components/schemas/EntityRef"
173186
type: object
174187
Bar_Create:
175188
allOf:
176189
- $ref: "#/components/schemas/Entity"
177-
properties:
178-
barPropA:
179-
type: string
180-
fooPropB:
181-
type: string
182-
foo:
183-
$ref: "#/components/schemas/FooRefOrValue"
190+
- properties:
191+
barPropA:
192+
type: string
193+
fooPropB:
194+
type: string
195+
foo:
196+
$ref: "#/components/schemas/FooRefOrValue"
197+
type: object
198+
example: null
184199
type: object
200+
example: null
185201
Bar:
186202
allOf:
187203
- $ref: "#/components/schemas/Entity"
204+
- properties:
205+
id:
206+
type: string
207+
barPropA:
208+
type: string
209+
fooPropB:
210+
type: string
211+
foo:
212+
$ref: "#/components/schemas/FooRefOrValue"
213+
required:
214+
- id
215+
type: object
216+
example: null
188217
example:
218+
'@baseType': '@baseType'
219+
'@type': '@type'
189220
foo:
221+
'@baseType': '@baseType'
222+
'@type': '@type'
190223
fooPropA: fooPropA
224+
href: href
225+
id: id
191226
fooPropB: fooPropB
227+
'@schemaLocation': '@schemaLocation'
228+
href: href
192229
id: id
193230
fooPropB: fooPropB
231+
'@schemaLocation': '@schemaLocation'
194232
barPropA: barPropA
195-
properties:
196-
id:
197-
type: string
198-
barPropA:
199-
type: string
200-
fooPropB:
201-
type: string
202-
foo:
203-
$ref: "#/components/schemas/FooRefOrValue"
204-
required:
205-
- id
206233
type: object
207234
BarRefOrValue:
208235
oneOf:
@@ -213,24 +240,33 @@ components:
213240
Pizza:
214241
allOf:
215242
- $ref: "#/components/schemas/Entity"
216-
properties:
217-
pizzaSize:
218-
type: number
243+
- properties:
244+
pizzaSize:
245+
type: number
246+
type: object
247+
example: null
219248
type: object
249+
example: null
220250
Pasta:
221251
allOf:
222252
- $ref: "#/components/schemas/Entity"
223-
properties:
224-
vendor:
225-
type: string
253+
- properties:
254+
vendor:
255+
type: string
256+
type: object
257+
example: null
226258
type: object
259+
example: null
227260
PizzaSpeziale:
228261
allOf:
229262
- $ref: "#/components/schemas/Pizza"
230-
properties:
231-
toppings:
232-
type: string
263+
- properties:
264+
toppings:
265+
type: string
266+
type: object
267+
example: null
233268
type: object
269+
example: null
234270
FruitType:
235271
enum:
236272
- APPLE

samples/client/others/java/webclient-sealedInterface/docs/EntityRef.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,18 @@
22

33
# EntityRef
44

5-
Entity reference schema to be use for all entityRef class.
65

76
## Properties
87

98
| Name | Type | Description | Notes |
109
|------------ | ------------- | ------------- | -------------|
11-
|**name** | **String** | Name of the related entity. | [optional] |
12-
|**atReferredType** | **String** | The actual type of the target instance when needed for disambiguation. | [optional] |
1310
|**href** | **String** | Hyperlink reference | [optional] |
1411
|**id** | **String** | unique identifier | [optional] |
1512
|**atSchemaLocation** | **String** | A URI to a JSON-Schema file that defines additional attributes and relationships | [optional] |
1613
|**atBaseType** | **String** | When sub-classing, this defines the super-class | [optional] |
1714
|**atType** | **String** | When sub-classing, this defines the sub-class Extensible name | |
15+
|**name** | **String** | Name of the related entity. | [optional] |
16+
|**atReferredType** | **String** | The actual type of the target instance when needed for disambiguation. | [optional] |
1817

1918

2019

0 commit comments

Comments
 (0)