Skip to content

Commit 2bbd428

Browse files
Add a specification structure that reproduces the regression
1 parent 753330d commit 2bbd428

116 files changed

Lines changed: 9116 additions & 3 deletions

File tree

Some content is hidden

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

.github/workflows/samples-java-client-jdk17.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
- samples/client/petstore/java/webclient-jakarta/**
88
- samples/client/petstore/java/restclient-*/**
99
- samples/client/others/java/webclient-sealedInterface/**
10+
- samples/client/others/java/webclient-sealedInterface-3.1/**
1011
- samples/client/petstore/java/webclient-useSingleRequestParameter/**
1112
- samples/client/others/java/restclient-enum-in-multipart/**
1213
pull_request:
@@ -15,6 +16,7 @@ on:
1516
- samples/client/petstore/java/webclient-jakarta/**
1617
- samples/client/petstore/java/restclient-*/**
1718
- samples/client/others/java/webclient-sealedInterface/**
19+
- samples/client/others/java/webclient-sealedInterface-3.1/**
1820
- samples/client/petstore/java/webclient-useSingleRequestParameter/**
1921
- samples/client/others/java/restclient-enum-in-multipart/**
2022
jobs:
@@ -34,6 +36,7 @@ jobs:
3436
- samples/client/petstore/java/restclient-useSingleRequestParameter
3537
- samples/client/petstore/java/restclient-useSingleRequestParameter-static
3638
- samples/client/others/java/webclient-sealedInterface
39+
- samples/client/others/java/webclient-sealedInterface-3.1
3740
- samples/client/petstore/java/webclient-useSingleRequestParameter
3841
- samples/client/others/java/restclient-enum-in-multipart
3942
steps:
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
generatorName: java
2+
outputDir: samples/client/others/java/webclient-sealedInterface_3_1
3+
library: webclient
4+
inputSpec: modules/openapi-generator/src/test/resources/3_1/oneof_polymorphism_and_inheritance.yaml
5+
templateDir: modules/openapi-generator/src/main/resources/Java
6+
additionalProperties:
7+
artifactId: sealed-interface-webclient
8+
hideGenerationTimestamp: "true"
9+
useOneOfInterfaces: true
10+
useSealedOneOfInterfaces: true

modules/openapi-generator/src/test/resources/3_0/oneof_polymorphism_and_inheritance.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ paths:
4848
'application/json':
4949
schema:
5050
$ref: '#/components/schemas/Bar'
51-
5251
components:
5352
schemas:
5453
Addressable:
@@ -185,8 +184,6 @@ components:
185184
properties:
186185
fruitType:
187186
$ref: "#/components/schemas/FruitType"
188-
required:
189-
- fruitType
190187
oneOf:
191188
- $ref: '#/components/schemas/Apple'
192189
- $ref: '#/components/schemas/Banana'
@@ -195,6 +192,8 @@ components:
195192
mapping:
196193
APPLE: '#/components/schemas/Apple'
197194
BANANA: '#/components/schemas/Banana'
195+
required:
196+
- fruitType
198197
Apple:
199198
type: object
200199
required:
Lines changed: 252 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,252 @@
1+
openapi: 3.1.0
2+
info:
3+
title: ByRefOrValue
4+
description: >
5+
This tests for a oneOf interface representation
6+
version: 0.0.1
7+
servers:
8+
- url: "http://localhost:8080"
9+
tags:
10+
- name: Foo
11+
- name: Bar
12+
paths:
13+
/foo:
14+
get:
15+
tags:
16+
- Foo
17+
summary: GET all Foos
18+
operationId: getAllFoos
19+
responses:
20+
'200':
21+
$ref: '#/components/responses/200FooArray'
22+
post:
23+
tags:
24+
- Foo
25+
summary: Create a Foo
26+
operationId: createFoo
27+
requestBody:
28+
$ref: '#/components/requestBodies/Foo'
29+
responses:
30+
'201':
31+
$ref: '#/components/responses/201Foo'
32+
/bar:
33+
post:
34+
tags:
35+
- Bar
36+
summary: Create a Bar
37+
operationId: createBar
38+
requestBody:
39+
required: true
40+
content:
41+
'application/json':
42+
schema:
43+
$ref: '#/components/schemas/Bar_Create'
44+
responses:
45+
200:
46+
description: Bar created
47+
content:
48+
'application/json':
49+
schema:
50+
$ref: '#/components/schemas/Bar'
51+
52+
components:
53+
schemas:
54+
Addressable:
55+
type: object
56+
properties:
57+
href:
58+
type: string
59+
description: Hyperlink reference
60+
id:
61+
type: string
62+
description: unique identifier
63+
description: Base schema for addressable entities
64+
Extensible:
65+
type: object
66+
properties:
67+
"@schemaLocation":
68+
type: string
69+
description: A URI to a JSON-Schema file that defines additional attributes
70+
and relationships
71+
"@baseType":
72+
type: string
73+
description: When sub-classing, this defines the super-class
74+
"@type":
75+
type: string
76+
description: When sub-classing, this defines the sub-class Extensible name
77+
required:
78+
- '@type'
79+
Entity:
80+
type: object
81+
discriminator:
82+
propertyName: '@type'
83+
allOf:
84+
- "$ref": "#/components/schemas/Addressable"
85+
- "$ref": "#/components/schemas/Extensible"
86+
EntityRef:
87+
type: object
88+
discriminator:
89+
propertyName: '@type'
90+
description: Entity reference schema to be use for all entityRef class.
91+
properties:
92+
name:
93+
type: string
94+
description: Name of the related entity.
95+
'@referredType':
96+
type: string
97+
description: The actual type of the target instance when needed for disambiguation.
98+
allOf:
99+
- $ref: '#/components/schemas/Addressable'
100+
- "$ref": "#/components/schemas/Extensible"
101+
FooRefOrValue:
102+
type: object
103+
oneOf:
104+
- $ref: "#/components/schemas/Foo"
105+
- $ref: "#/components/schemas/FooRef"
106+
discriminator:
107+
propertyName: "@type"
108+
Foo:
109+
type: object
110+
properties:
111+
fooPropA:
112+
type: string
113+
fooPropB:
114+
type: string
115+
allOf:
116+
- $ref: '#/components/schemas/Entity'
117+
FooRef:
118+
type: object
119+
properties:
120+
foorefPropA:
121+
type: string
122+
allOf:
123+
- $ref: '#/components/schemas/EntityRef'
124+
BarRef:
125+
type: object
126+
allOf:
127+
- $ref: '#/components/schemas/EntityRef'
128+
Bar_Create:
129+
type: object
130+
properties:
131+
barPropA:
132+
type: string
133+
fooPropB:
134+
type: string
135+
foo:
136+
$ref: '#/components/schemas/FooRefOrValue'
137+
allOf:
138+
- $ref: '#/components/schemas/Entity'
139+
Bar:
140+
type: object
141+
required:
142+
- id
143+
properties:
144+
id:
145+
type: string
146+
barPropA:
147+
type: string
148+
fooPropB:
149+
type: string
150+
foo:
151+
$ref: '#/components/schemas/FooRefOrValue'
152+
allOf:
153+
- $ref: '#/components/schemas/Entity'
154+
BarRefOrValue:
155+
type: object
156+
oneOf:
157+
- $ref: "#/components/schemas/Bar"
158+
- $ref: "#/components/schemas/BarRef"
159+
Pizza:
160+
type: object
161+
properties:
162+
pizzaSize:
163+
type: number
164+
allOf:
165+
- $ref: '#/components/schemas/Entity'
166+
Pasta:
167+
type: object
168+
properties:
169+
vendor:
170+
type: string
171+
allOf:
172+
- $ref: '#/components/schemas/Entity'
173+
PizzaSpeziale:
174+
type: object
175+
properties:
176+
toppings:
177+
type: string
178+
allOf:
179+
- $ref: '#/components/schemas/Pizza'
180+
FruitType:
181+
type: string
182+
enum: [APPLE, BANANA]
183+
Fruit:
184+
type: object
185+
properties:
186+
fruitType:
187+
$ref: "#/components/schemas/FruitType"
188+
required:
189+
- fruitType
190+
oneOf:
191+
- $ref: '#/components/schemas/Apple'
192+
- $ref: '#/components/schemas/Banana'
193+
discriminator:
194+
propertyName: fruitType
195+
mapping:
196+
APPLE: '#/components/schemas/Apple'
197+
BANANA: '#/components/schemas/Banana'
198+
Apple:
199+
type: object
200+
required:
201+
- seeds
202+
properties:
203+
seeds:
204+
type: integer
205+
Banana:
206+
type: object
207+
required:
208+
- length
209+
properties:
210+
length:
211+
type: integer
212+
Animal:
213+
oneOf:
214+
- $ref: '#/components/schemas/Dog'
215+
- $ref: '#/components/schemas/Cat'
216+
Cat:
217+
type: object
218+
properties:
219+
declawed:
220+
type: boolean
221+
Dog:
222+
type: object
223+
properties:
224+
bark:
225+
type: boolean
226+
227+
requestBodies:
228+
Foo:
229+
description: The Foo to be created
230+
content:
231+
application/json;charset=utf-8:
232+
schema:
233+
$ref: '#/components/schemas/Foo'
234+
235+
responses:
236+
'204':
237+
description: Deleted
238+
content: { }
239+
201Foo:
240+
description: Error
241+
content:
242+
application/json:
243+
schema:
244+
$ref: '#/components/schemas/FooRefOrValue'
245+
200FooArray:
246+
description: Success
247+
content:
248+
application/json;charset=utf-8:
249+
schema:
250+
type: array
251+
items:
252+
$ref: '#/components/schemas/FooRefOrValue'
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
2+
3+
# Apple2
4+
5+
6+
## Properties
7+
8+
| Name | Type | Description | Notes |
9+
|------------ | ------------- | ------------- | -------------|
10+
|**seeds** | **Integer** | | |
11+
|**type** | **FruitType** | | |
12+
13+
14+
## Implemented Interfaces
15+
16+
* Fruit2
17+
18+
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
2+
3+
# Banana2
4+
5+
6+
## Properties
7+
8+
| Name | Type | Description | Notes |
9+
|------------ | ------------- | ------------- | -------------|
10+
|**length** | **Integer** | | |
11+
|**type** | **FruitType** | | |
12+
13+
14+
## Implemented Interfaces
15+
16+
* Fruit2
17+
18+
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
3+
# Interface Fruit2
4+
5+
## Implementing Classes
6+
7+
* Apple2
8+
* Banana2
9+
10+

0 commit comments

Comments
 (0)