Skip to content

Commit 666d10c

Browse files
committed
comments for all test cases
1 parent c0cd4f0 commit 666d10c

20 files changed

+192
-194
lines changed

tests/schema/fail/components-object-wrong-field-types.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ openapi: 3.1.0
22
info:
33
title: API
44
version: 1.0.0
5-
components:
5+
components: # must all be objects
66
schemas: []
77
responses: []
88
parameters: []

tests/schema/fail/components-schemas-invalid-types.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ info:
66
title: API
77
version: 1.0.0
88
components:
9-
schemas:
9+
schemas: # must all be objects
1010
invalid_null: null
1111
invalid_number: 0
1212
invalid_array: []

tests/schema/fail/info-contact-wrong-field-types.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ info:
33
title: API
44
version: 1.0.0
55
contact:
6-
name: true
7-
email: true
8-
url: true
6+
name: true # must be a string
7+
email: true # must be a string
8+
url: true # must be a string
99
paths: {}

tests/schema/fail/info-license-no-name.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ openapi: 3.1.0
22
info:
33
title: API
44
version: 1.0.0
5-
license: {} # must have name
5+
license: {} # must have `name` field`
66
paths: {}

tests/schema/fail/info-license-wrong-field-types.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ info:
33
title: API
44
version: 1.0.0
55
license:
6-
name: true
7-
identifier: true
8-
url: true
6+
name: true # must be a string
7+
identifier: true # must be a string
8+
url: true # must be a string
99
paths: {}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
openapi: 3.1.0
2-
# info is required
2+
# `info` field is required
33
paths: {}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
openapi: 3.1.0
22
info:
3-
summary: must have title and version
3+
summary: must have `title` and `version` fields
44
paths: {}
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
openapi: 3.1.0
22
info:
3-
title: true
4-
summary: true
5-
description: true
6-
termsOfService: true
7-
version: 1
8-
contact: true
9-
license: true
3+
title: true # must be a string
4+
summary: true # must be a string
5+
description: true # must be a string
6+
termsOfService: true # must be a string
7+
version: 1 # must be a string
8+
contact: true # must be a string
9+
license: true # must be a string

tests/schema/fail/invalid-components.yaml

Lines changed: 84 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -4,163 +4,160 @@ info:
44
version: 1.0.0
55
components:
66
pathItems:
7-
ö: true
7+
ö: true # wrong map key pattern
88
invalid:
9-
$ref: 42
10-
summary: true
11-
description: true
12-
servers: true
13-
parameters: true
9+
$ref: 42 # must be a string
10+
summary: true # must be a string
11+
description: true # must be a string
12+
servers: true # must be an array
13+
parameters: true # must be an array
1414
invalid-operations:
1515
get:
16-
tags: true
17-
summary: true
18-
description: true
19-
operationId: true
20-
parameters: true
21-
callbacks: true
22-
deprecated: maybe
23-
security: no
24-
servers: none
25-
patch: false
16+
tags: true # must be an array
17+
summary: true # must be a string
18+
description: true # must be a string
19+
operationId: true # must be a string
20+
parameters: true # must be an array
21+
callbacks: true # must be an object
22+
deprecated: maybe # must be a boolean
23+
security: no # must be an array
24+
servers: none # must be an array
25+
patch: false # must be an object
2626
invalid-responses:
2727
get:
28-
tags: [true]
29-
responses: false
28+
tags: [true] # array items must be strings
29+
responses: false # must be an object
3030
patch:
31-
responses: {}
31+
responses: {} # must have at least one field
3232
post:
3333
responses:
34-
invalid: true
34+
invalid: true # must be an object
3535
requestBodies:
36-
no-object: true
36+
no-object: true # must be an object
3737
invalid:
38-
description: true
39-
required: no
38+
description: true # must be a string
39+
required: no # must be a boolean
4040
parameters:
41-
no-object: true
42-
no-in:
41+
no-object: true # must be an object
42+
no-in: # object must have `in` field
4343
name: id
4444
schema:
4545
type: string
4646
invalid:
47-
name: 42
48-
in: invalid
49-
description: true
50-
required: no
51-
deprecated: no
52-
content: {}
47+
name: 42 # must be a string
48+
in: invalid # must be one of `query`, `header`, `path`, `cookie`
49+
description: true # must be a string
50+
required: no # must be a boolean
51+
deprecated: no # must be a boolean
52+
content: {} # must have at least one field
5353
invalid-content:
5454
name: id
5555
content:
56-
one: true
57-
two: false
58-
invalid-querystring:
56+
one: true # must be an object
57+
two: false # must be an object
58+
invalid-querystring: # must have `content` field
5959
name: id
60-
in: querystring
60+
in: querystring
6161
optional-path:
6262
name: id
6363
in: path
6464
schema:
6565
type: string
66-
required: false
66+
required: false # must be true for path parameters
6767
invalid-path:
6868
name: id
6969
in: path
7070
schema:
7171
type: string
72-
style: invalid
73-
allowReserved: yes
72+
style: invalid # must be one of the allowed enum values
73+
allowReserved: yes # must be a boolean
7474
invalid-header:
7575
name: id
7676
in: header
7777
schema:
7878
type: string
79-
style: 42
79+
style: 42 # must be the string "simple"
8080
invalid-query:
8181
name: id
8282
in: query
8383
schema:
8484
type: string
85-
style: invalid
86-
allowEmptyValue: yes
87-
allowReserved: no
85+
style: invalid # must be one of the allowed enum values
86+
allowEmptyValue: yes # must be a boolean
87+
allowReserved: no # must be a boolean
8888
invalid-cookie:
8989
name: id
9090
in: cookie
9191
schema:
9292
type: string
93-
style: invalid
93+
style: invalid # must be one of the allowed enum values
9494
invalid-examples:
9595
name: id
9696
in: query
9797
schema:
9898
type: string
99-
examples: true
100-
explode: 42
99+
examples: true # must be an object
100+
explode: 42 # must be a boolean
101101
callbacks:
102-
no-object: true
102+
no-object: true # must be an object
103103
invalid:
104-
foo: true
104+
foo: true # must be an object
105105
links:
106-
no-object: true
106+
no-object: true # must be an object
107107
invalid:
108-
description: true
109-
operationId: true
110-
operationRef: true
111-
parameters: true
112-
requestBody: true
113-
responses: true
114-
server: true
115-
servers: true
116-
deprecated: no
108+
description: true # must be a string
109+
operationId: true # must be a string
110+
operationRef: true # must be a string
111+
parameters: true # must be an object
112+
responses: true # must be an object
113+
server: true # must be an object
117114
headers:
118-
no-object: true
115+
no-object: true # must be an object
119116
invalid:
120-
description: true
121-
required: yes
122-
deprecated: no
123-
content: {}
117+
description: true # must be a string
118+
required: yes # must be a boolean
119+
deprecated: no # must be a boolean
120+
content: {} # must have at least one field
124121
invalid-content:
125122
content:
126-
one: true
127-
two: false
123+
one: true # must be an object
124+
two: false # must be an object
128125
invalid-style:
129126
schema:
130127
type: string
131-
style: true
132-
explode: no
133-
allowReserved: yes
128+
style: true # must be a string
129+
explode: no # must be a boolean
130+
allowReserved: yes # must be a boolean
134131
examples:
135-
no-object: true
132+
no-object: true # must be an object
136133
invalid-reference:
137-
$ref: 42
138-
summary: false
139-
description: true
134+
$ref: 42 # must be a string
135+
summary: false # must be a string
136+
description: true # must be a string
140137
invalid:
141-
summary: true
142-
description: true
143-
externalValue: true
138+
summary: true # must be a string
139+
description: true # must be a string
140+
externalValue: true # must be a string
144141
responses:
145-
no-object: true
142+
no-object: true # must be an object
146143
invalid:
147-
summary: true
148-
description: true
149-
headers: true
150-
links: true
151-
content: true
144+
summary: true # must be a string
145+
description: true # must be a string
146+
headers: true # must be an object
147+
links: true # must be an object
148+
content: true # must be an object
152149
invalid-encoding:
153150
content:
154151
'application/json':
155-
encoding: true
152+
encoding: true # must be an object
156153
invalid-encoding-object:
157154
content:
158155
'application/json':
159156
encoding:
160-
foo: true
157+
foo: true # must be an object
161158
bar:
162-
contentType: true
163-
headers: true
164-
style: true
165-
explode: yes
166-
allowReserved: no
159+
contentType: true # must be a string
160+
headers: true # must be an object
161+
style: true # must be a string
162+
explode: yes # must be a boolean
163+
allowReserved: no # must be a boolean

tests/schema/fail/invalid-schema-object.yaml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,23 @@ info:
55
components:
66
schemas:
77
externalDocs-no-object:
8-
externalDocs: true
8+
externalDocs: true # must be an object
99
externalDocs-incomplete:
10-
externalDocs:
11-
description: true
10+
externalDocs: # must have `url` field
11+
description: true # must be a string
1212
externalDocs-invalid-url:
1313
externalDocs:
14-
url: true
14+
url: true # must be a string
1515
discriminator-no-object:
16-
discriminator: true
16+
discriminator: true # must be an object
1717
discriminator-incomplete:
18+
discriminator: # must have `propertyName` field
19+
mapping: true # must be an object
20+
discriminator-invalid-field-values:
1821
discriminator:
19-
mapping: true
20-
discriminator-invalid-propertyName:
21-
discriminator:
22-
propertyName: true
22+
propertyName: true # must be a string
2323
discriminator-invalid-mapping:
2424
discriminator:
25+
propertyName: foo
2526
mapping:
26-
key: true
27+
key: true # must be a string

0 commit comments

Comments
 (0)