@@ -28,6 +28,8 @@ final class Test_FilteredDocument: XCTestCase {
28
28
- name: t
29
29
paths:
30
30
/things/a:
31
+ parameters:
32
+ - $ref: '#/components/parameters/A'
31
33
get:
32
34
operationId: getA
33
35
tags:
@@ -52,6 +54,12 @@ final class Test_FilteredDocument: XCTestCase {
52
54
type: string
53
55
B:
54
56
$ref: '#/components/schemas/A'
57
+ parameters:
58
+ A:
59
+ in: query
60
+ schema:
61
+ type: string
62
+ name: A
55
63
responses:
56
64
A:
57
65
description: success
@@ -75,14 +83,16 @@ final class Test_FilteredDocument: XCTestCase {
75
83
filter: DocumentFilter ( tags: [ " t " ] ) ,
76
84
hasPaths: [ " /things/a " ] ,
77
85
hasOperations: [ " getA " ] ,
78
- hasSchemas: [ " A " ]
86
+ hasSchemas: [ " A " ] ,
87
+ hasParameters: [ " A " ]
79
88
)
80
89
assert (
81
90
filtering: document,
82
91
filter: DocumentFilter ( paths: [ " /things/a " ] ) ,
83
92
hasPaths: [ " /things/a " ] ,
84
93
hasOperations: [ " getA " , " deleteA " ] ,
85
- hasSchemas: [ " A " ]
94
+ hasSchemas: [ " A " ] ,
95
+ hasParameters: [ " A " ]
86
96
)
87
97
assert (
88
98
filtering: document,
@@ -96,7 +106,8 @@ final class Test_FilteredDocument: XCTestCase {
96
106
filter: DocumentFilter ( paths: [ " /things/a " , " /things/b " ] ) ,
97
107
hasPaths: [ " /things/a " , " /things/b " ] ,
98
108
hasOperations: [ " getA " , " deleteA " , " getB " ] ,
99
- hasSchemas: [ " A " , " B " ]
109
+ hasSchemas: [ " A " , " B " ] ,
110
+ hasParameters: [ " A " ]
100
111
)
101
112
assert (
102
113
filtering: document,
@@ -117,21 +128,24 @@ final class Test_FilteredDocument: XCTestCase {
117
128
filter: DocumentFilter ( paths: [ " /things/a " ] , schemas: [ " B " ] ) ,
118
129
hasPaths: [ " /things/a " ] ,
119
130
hasOperations: [ " getA " , " deleteA " ] ,
120
- hasSchemas: [ " A " , " B " ]
131
+ hasSchemas: [ " A " , " B " ] ,
132
+ hasParameters: [ " A " ]
121
133
)
122
134
assert (
123
135
filtering: document,
124
136
filter: DocumentFilter ( tags: [ " t " ] , schemas: [ " B " ] ) ,
125
137
hasPaths: [ " /things/a " ] ,
126
138
hasOperations: [ " getA " ] ,
127
- hasSchemas: [ " A " , " B " ]
139
+ hasSchemas: [ " A " , " B " ] ,
140
+ hasParameters: [ " A " ]
128
141
)
129
142
assert (
130
143
filtering: document,
131
144
filter: DocumentFilter ( operations: [ " deleteA " ] ) ,
132
145
hasPaths: [ " /things/a " ] ,
133
146
hasOperations: [ " deleteA " ] ,
134
- hasSchemas: [ ]
147
+ hasSchemas: [ ] ,
148
+ hasParameters: [ " A " ]
135
149
)
136
150
}
137
151
@@ -141,6 +155,7 @@ final class Test_FilteredDocument: XCTestCase {
141
155
hasPaths paths: [ OpenAPI . Path . RawValue ] ,
142
156
hasOperations operationIDs: [ String ] ,
143
157
hasSchemas schemas: [ String ] ,
158
+ hasParameters parameters: [ String ] = [ ] ,
144
159
file: StaticString = #filePath,
145
160
line: UInt = #line
146
161
) {
@@ -149,11 +164,31 @@ final class Test_FilteredDocument: XCTestCase {
149
164
XCTFail ( " Filter threw error: \( error) " , file: file, line: line)
150
165
return
151
166
}
152
- XCTAssertUnsortedEqual ( filteredDocument. paths. keys. map ( \. rawValue) , paths, file: file, line: line)
153
- XCTAssertUnsortedEqual ( filteredDocument. allOperationIds, operationIDs, file: file, line: line)
167
+ XCTAssertUnsortedEqual (
168
+ filteredDocument. paths. keys. map ( \. rawValue) ,
169
+ paths,
170
+ " Paths don't match " ,
171
+ file: file,
172
+ line: line
173
+ )
174
+ XCTAssertUnsortedEqual (
175
+ filteredDocument. allOperationIds,
176
+ operationIDs,
177
+ " Operations don't match " ,
178
+ file: file,
179
+ line: line
180
+ )
154
181
XCTAssertUnsortedEqual (
155
182
filteredDocument. components. schemas. keys. map ( \. rawValue) ,
156
183
schemas,
184
+ " Schemas don't match " ,
185
+ file: file,
186
+ line: line
187
+ )
188
+ XCTAssertUnsortedEqual (
189
+ filteredDocument. components. parameters. keys. map ( \. rawValue) ,
190
+ parameters,
191
+ " Parameters don't match " ,
157
192
file: file,
158
193
line: line
159
194
)
0 commit comments