Skip to content

Commit f50e429

Browse files
committed
Comments on all wrong field values
1 parent 34aec21 commit f50e429

29 files changed

+207
-209
lines changed

tests/schema/fail/$self-no-string.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
openapi: 3.2.0
2-
$self: 42 # must be a string, not a number
2+
$self: 42 # must be a string, must be a number
33
info:
44
title: API
55
version: 1.0.0

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.2.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.2.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: {}

tests/schema/fail/info-missing.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
openapi: 3.2.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.2.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.2.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: 89 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -4,169 +4,166 @@ 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
14-
additionalOperations: none
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
14+
additionalOperations: none # must be an object
1515
invalid-additionalOperations:
1616
additionalOperations:
17-
ö: true
17+
ö: true # wrong map key pattern
1818
invalid-operations:
1919
get:
20-
tags: true
21-
summary: true
22-
description: true
23-
operationId: true
24-
parameters: true
25-
callbacks: true
26-
deprecated: maybe
27-
security: no
28-
servers: none
29-
patch: false
20+
tags: true # must be an array
21+
summary: true # must be a string
22+
description: true # must be a string
23+
operationId: true # must be a string
24+
parameters: true # must be an array
25+
callbacks: true # must be an object
26+
deprecated: maybe # must be a boolean
27+
security: no # must be an array
28+
servers: none # must be an array
29+
patch: false # must be an object
3030
invalid-responses:
3131
get:
32-
tags: [true]
33-
responses: false
32+
tags: [true] # array items must be strings
33+
responses: false # must be an object
3434
patch:
35-
responses: {}
35+
responses: {} # must have at least one field
3636
post:
3737
responses:
38-
invalid: true
38+
invalid: true # must be an object
3939
requestBodies:
40-
no-object: true
40+
no-object: true # must be an object
4141
invalid:
42-
description: true
43-
required: no
42+
description: true # must be a string
43+
required: no # must be a boolean
4444
parameters:
45-
no-object: true
46-
no-in:
45+
no-object: true # must be an object
46+
no-in: # object must have `in` field
4747
name: id
4848
schema:
4949
type: string
5050
invalid:
51-
name: 42
52-
in: invalid
53-
description: true
54-
required: no
55-
deprecated: no
56-
content: {}
51+
name: 42 # must be a string
52+
in: invalid # must be one of `query`, `header`, `path`, `cookie`
53+
description: true # must be a string
54+
required: no # must be a boolean
55+
deprecated: no # must be a boolean
56+
content: {} # must have at least one field
5757
invalid-content:
5858
name: id
5959
content:
60-
one: true
61-
two: false
62-
invalid-querystring:
60+
one: true # must be an object
61+
two: false # must be an object
62+
invalid-querystring: # must have `content` field
6363
name: id
64-
in: querystring
64+
in: querystring
6565
optional-path:
6666
name: id
6767
in: path
6868
schema:
6969
type: string
70-
required: false
70+
required: false # must be true for path parameters
7171
invalid-path:
7272
name: id
7373
in: path
7474
schema:
7575
type: string
76-
style: invalid
77-
allowReserved: yes
76+
style: invalid # must be one of the allowed enum values
77+
allowReserved: yes # must be a boolean
7878
invalid-header:
7979
name: id
8080
in: header
8181
schema:
8282
type: string
83-
style: 42
83+
style: 42 # must be the string "simple"
8484
invalid-query:
8585
name: id
8686
in: query
8787
schema:
8888
type: string
89-
style: invalid
90-
allowEmptyValue: yes
89+
style: invalid # must be one of the allowed enum values
90+
allowEmptyValue: yes # must be a boolean
9191
invalid-cookie:
9292
name: id
9393
in: cookie
9494
schema:
9595
type: string
96-
style: invalid
96+
style: invalid # must be one of the allowed enum values
9797
invalid-examples:
9898
name: id
9999
in: query
100100
schema:
101101
type: string
102-
examples: true
103-
explode: 42
102+
examples: true # must be an object
103+
explode: 42 # must be a boolean
104104
callbacks:
105-
no-object: true
105+
no-object: true # must be an object
106106
invalid:
107-
foo: true
107+
foo: true # must be an object
108108
links:
109-
no-object: true
109+
no-object: true # must be an object
110110
invalid:
111-
description: true
112-
operationId: true
113-
operationRef: true
114-
parameters: true
115-
requestBody: true
116-
responses: true
117-
server: true
118-
servers: true
119-
deprecated: no
111+
description: true # must be a string
112+
operationId: true # must be a string
113+
operationRef: true # must be a string
114+
parameters: true # must be an object
115+
responses: true # must be an object
116+
server: true # must be an object
120117
headers:
121-
no-object: true
118+
no-object: true # must be an object
122119
invalid:
123-
description: true
124-
required: yes
125-
deprecated: no
126-
content: {}
120+
description: true # must be a string
121+
required: yes # must be a boolean
122+
deprecated: no # must be a boolean
123+
content: {} # must have at least one field
127124
invalid-content:
128-
content:
129-
one: true
130-
two: false
125+
content:
126+
one: true # must be an object
127+
two: false # must be an object
131128
invalid-style:
132129
schema:
133130
type: string
134-
style: true
135-
explode: no
136-
allowReserved: yes
131+
style: true # must be a string
132+
explode: no # must be a boolean
133+
allowReserved: yes # must be a boolean
137134
examples:
138-
no-object: true
135+
no-object: true # must be an object
139136
invalid-reference:
140-
$ref: 42
141-
summary: false
142-
description: true
137+
$ref: 42 # must be a string
138+
summary: false # must be a string
139+
description: true # must be a string
143140
invalid:
144-
summary: true
145-
description: true
146-
externalValue: true
141+
summary: true # must be a string
142+
description: true # must be a string
143+
externalValue: true # must be a string
147144
responses:
148-
no-object: true
145+
no-object: true # must be an object
149146
invalid:
150-
summary: true
151-
description: true
152-
headers: true
153-
links: true
154-
content: true
147+
summary: true # must be a string
148+
description: true # must be a string
149+
headers: true # must be an object
150+
links: true # must be an object
151+
content: true # must be an object
155152
invalid-encoding:
156153
content:
157154
'application/json':
158-
encoding: true
155+
encoding: true # must be an object
159156
invalid-encoding-object:
160157
content:
161158
'application/json':
162-
description: true
159+
description: true # must be a string
163160
encoding:
164-
foo: true
161+
foo: true # must be an object
165162
bar:
166-
contentType: true
167-
headers: true
168-
style: true
169-
explode: yes
170-
allowReserved: no
171-
encoding: true
172-
prefixEncoding: true
163+
contentType: true # must be a string
164+
headers: true # must be an object
165+
style: true # must be a string
166+
explode: yes # must be a boolean
167+
allowReserved: no # must be a boolean
168+
encoding: true # must be an object
169+
prefixEncoding: true # must be an array

0 commit comments

Comments
 (0)