Skip to content

Commit 07420c3

Browse files
committed
added new one-of spec for testing
1 parent cf950b2 commit 07420c3

File tree

1 file changed

+105
-0
lines changed

1 file changed

+105
-0
lines changed

docs/examples/specs/oneof-1.yaml

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
openapi: "3.0.2"
2+
info:
3+
title: "API example"
4+
description: "Sample desc."
5+
version: "1"
6+
7+
8+
9+
servers:
10+
# Added by API Auto Mocking Plugin
11+
- description: SwaggerHub API Auto Mocking
12+
url: https://virtserver.swaggerhub.com/leorush/testtw/1
13+
- url: http://demo.example.com
14+
description: Demo server
15+
16+
17+
18+
19+
paths:
20+
/registration/domains:
21+
post:
22+
requestBody:
23+
required: true
24+
content:
25+
application/json:
26+
schema:
27+
oneOf:
28+
- $ref: '#/components/schemas/domain_order_data'
29+
- $ref: '#/components/schemas/domain_order_data_org'
30+
discriminator:
31+
propertyName: customer_type
32+
mapping:
33+
person: '#/components/schemas/domain_order_data'
34+
org: '#/components/schemas/domain_order_data_org'
35+
36+
responses:
37+
200:
38+
$ref: '#/components/responses/customer_reg'
39+
40+
41+
components:
42+
schemas:
43+
common_data:
44+
type: object
45+
required:
46+
- customer_type
47+
properties:
48+
customer_type:
49+
type: string
50+
enum:
51+
- "person"
52+
- "org"
53+
description: "client type"
54+
example: "person"
55+
56+
common_org_data:
57+
type: object
58+
required:
59+
- org_address
60+
- org_name
61+
properties:
62+
63+
org_address:
64+
type: string
65+
example: "bbb"
66+
org_name:
67+
type: string
68+
example: "aaa"
69+
70+
domain_order_data:
71+
allOf:
72+
- type: object
73+
required:
74+
- domains
75+
- phone_number
76+
properties:
77+
domains:
78+
type: array
79+
items:
80+
type: string
81+
example: ["tesrrrrrrr.com"]
82+
phone_number:
83+
type: string
84+
example: "79219523621"
85+
- $ref: '#/components/schemas/common_data'
86+
87+
domain_order_data_org:
88+
allOf:
89+
- $ref: '#/components/schemas/common_org_data'
90+
- $ref: '#/components/schemas/domain_order_data'
91+
92+
93+
94+
responses:
95+
customer_reg:
96+
description: "sample"
97+
content:
98+
application/json:
99+
schema:
100+
type: object
101+
properties:
102+
password:
103+
type: string
104+
description: "user password"
105+
example: "zOmjt68sej6S"

0 commit comments

Comments
 (0)