-
-
Notifications
You must be signed in to change notification settings - Fork 240
/
petstore.scenario
200 lines (200 loc) · 5.28 KB
/
petstore.scenario
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
====test====
OAS 3.1 - Validate Petstore
====document====
openapi: 3.1.0
info:
title: Kitchen Sink OAS3.1
summary: A short kinda subtitle thing which helps if your API name is silly.
version: '1.0'
contact:
name: Bob the Builder
servers:
- url: 'http://localhost:3000'
- url: 'https://{username}.localhost:3000/{basePath}'
variables:
username:
default: demo
description: this value is assigned by the service provider, in this example `gigantic-server.com`
port:
enum:
- '8443'
- '443'
default: '8443'
paths:
'/users/{userId}':
parameters:
- name: userId
in: path
required: true
description: Id of an existing user.
schema:
type: integer
get:
x-internal: true
summary: Get User Info by User ID
responses:
'200':
description: User Found
content:
application/json:
schema:
$ref: '#/components/schemas/User'
examples:
Whatever Name We Like:
value:
id: 142
firstName: Alice
lastName: Smith
email: [email protected]
dateOfBirth: '1997-10-31'
emailVerified: true
age: 24
operationId: get-users-userId
description: Retrieve the information of the user with the matching user ID.
patch:
summary: Update User Information
operationId: patch-users-userId
responses:
'200':
description: User Updated
content:
application/json:
schema:
$ref: '#/components/schemas/User'
requestBody:
content:
application/json:
schema:
type: object
properties:
firstName:
type: string
lastName:
type: string
email:
type: string
format: email
description: >-
If a new email is given, the user's email verified property
will be set to false.
dateOfBirth:
type: string
format: date
example: '1985-10-02'
examples:
Update First Name:
value:
firstName: Rebecca
Update Email:
value:
email: [email protected]
Update Last Name & Date of Birth:
value:
lastName: Baker
dateOfBirth: '1985-10-02'
/users:
post:
summary: Create New User
operationId: post-user
responses:
'200':
description: User Created
content:
application/json:
schema:
$ref: '#/components/schemas/User'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/User'
required:
- firstName
- lastName
- email
- dateOfBirth
examples:
Create User Bob Fellow:
value:
firstName: Bob
lastName: Fellow
email: [email protected]
dateOfBirth: '1996-08-24'
age: 25
'/users/{userId}/avatar':
parameters:
- schema:
type: string
name: userId
in: path
required: true
put:
operationId: put-users-userId-avatar
responses:
'200':
description: OK
summary: Create or replace your avatar.
parameters:
- name: avatar
schema:
type: string
in: header
components:
schemas:
User:
title: User
type: object
properties:
id:
type: integer
description: Unique identifier for the given user.
examples:
- 13
readOnly: true
firstName:
type: string
examples:
- Rebecca
lastName:
type: string
examples:
- Baker
email:
type: string
format: email
examples:
phone:
type:
- string
- 'null'
dateOfBirth:
type: string
format: date
examples:
- '1985-10-02'
emailVerified:
type: boolean
description: Set to true if the user's email has been verified.
readOnly: true
createDate:
type: string
format: date
description: The date that the user was created.
readOnly: true
examples:
- '2019-08-24'
age:
type: number
description: Hold old is the user at time of signup.
exclusiveMinimum: 18
examples:
- 36
====asset:ruleset.yaml====
extends: [[spectral:oas, off]]
rules:
oas3-schema: error
====command====
{bin} lint {document} --ruleset {asset:ruleset.yaml}
====stdout====
No results with a severity of 'error' found!