Skip to content

Commit 0722f8c

Browse files
committed
added composed model samples on petsotre 3.0.0 definitions
1 parent d4704e5 commit 0722f8c

File tree

2 files changed

+108
-1
lines changed

2 files changed

+108
-1
lines changed

modules/swagger-codegen/src/test/resources/3_0_0/petstore-with-fake-endpoints-models-for-testing.yaml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,31 @@ paths:
290290
- petstore_auth:
291291
- write:pets
292292
- read:pets
293+
/randomPet:
294+
get:
295+
tags:
296+
- pet
297+
operationId: getRandomPet
298+
responses:
299+
'200':
300+
description: "a single random pet"
301+
content:
302+
application/json:
303+
schema:
304+
$ref: '#/components/schemas/SinglePetResponse'
305+
/allPets:
306+
get:
307+
tags:
308+
- pet
309+
operationId: getAllPets
310+
responses:
311+
'200':
312+
description: "a single random pet"
313+
content:
314+
application/json:
315+
schema:
316+
$ref: '#/components/schemas/AllPetsResponse'
317+
293318
/store/inventory:
294319
get:
295320
tags:
@@ -1787,6 +1812,25 @@ components:
17871812
- name: "name"
17881813
id: 1
17891814
status: "available"
1815+
1816+
SinglePetResponse:
1817+
type: object
1818+
properties:
1819+
pet:
1820+
oneOf:
1821+
- $ref: "#/components/schemas/Dog"
1822+
- $ref: "#/components/schemas/Cat"
1823+
discriminator:
1824+
propertyName: pet_type
1825+
AllPetsResponse:
1826+
type: array
1827+
items:
1828+
oneOf:
1829+
- $ref: "#/components/schemas/Dog"
1830+
- $ref: "#/components/schemas/Cat"
1831+
discriminator:
1832+
propertyName: pet_type
1833+
17901834
hasOnlyReadOnly:
17911835
type: object
17921836
properties:

modules/swagger-codegen/src/test/resources/3_0_0/petstore.yaml

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,30 @@ paths:
264264
schema:
265265
type: string
266266
format: binary
267+
/randomPet:
268+
get:
269+
tags:
270+
- pet
271+
operationId: getRandomPet
272+
responses:
273+
'200':
274+
description: "a single random pet"
275+
content:
276+
application/json:
277+
schema:
278+
$ref: '#/components/schemas/SinglePetResponse'
279+
/allPets:
280+
get:
281+
tags:
282+
- pet
283+
operationId: getAllPets
284+
responses:
285+
'200':
286+
description: "a single random pet"
287+
content:
288+
application/json:
289+
schema:
290+
$ref: '#/components/schemas/AllPetsResponse'
267291
/store/inventory:
268292
get:
269293
tags:
@@ -649,6 +673,45 @@ components:
649673
- sold
650674
xml:
651675
name: Pet
676+
677+
SinglePetResponse:
678+
type: object
679+
properties:
680+
pet:
681+
oneOf:
682+
- $ref: "#/components/schemas/Dog"
683+
- $ref: "#/components/schemas/Cat"
684+
discriminator:
685+
propertyName: pet_type
686+
AllPetsResponse:
687+
type: array
688+
items:
689+
oneOf:
690+
- $ref: "#/components/schemas/Dog"
691+
- $ref: "#/components/schemas/Cat"
692+
discriminator:
693+
propertyName: pet_type
694+
695+
Dog:
696+
allOf:
697+
- $ref: '#/components/schemas/Pet'
698+
- type: object
699+
properties:
700+
bark:
701+
type: boolean
702+
breed:
703+
type: string
704+
enum: [Dingo, Husky, Retriever, Shepherd]
705+
Cat:
706+
allOf:
707+
- $ref: '#/components/schemas/Pet'
708+
- type: object
709+
properties:
710+
hunts:
711+
type: boolean
712+
age:
713+
type: integer
714+
652715
ApiResponse:
653716
type: object
654717
properties:
@@ -697,4 +760,4 @@ components:
697760
api_key:
698761
type: apiKey
699762
name: api_key
700-
in: header
763+
in: header

0 commit comments

Comments
 (0)