@@ -48,8 +48,11 @@ public void ValidateRequiredIsTrueWhenInIsPathInParameter()
48
48
} ;
49
49
50
50
// Act
51
- var errors = parameter . Validate ( ValidationRuleSet . GetDefaultRuleSet ( ) ) ;
52
-
51
+ var validator = new OpenApiValidator ( ValidationRuleSet . GetDefaultRuleSet ( ) ) ;
52
+ validator . Enter ( "{name}" ) ;
53
+ var walker = new OpenApiWalker ( validator ) ;
54
+ walker . Walk ( parameter ) ;
55
+ var errors = validator . Errors ;
53
56
// Assert
54
57
errors . Should ( ) . NotBeEmpty ( ) ;
55
58
errors . Select ( e => e . Message ) . Should ( ) . BeEquivalentTo ( new [ ]
@@ -77,6 +80,7 @@ public void ValidateExampleShouldNotHaveDataTypeMismatchForSimpleSchema()
77
80
78
81
// Act
79
82
var validator = new OpenApiValidator ( ValidationRuleSet . GetDefaultRuleSet ( ) ) ;
83
+ validator . Enter ( "{parameter1}" ) ;
80
84
var walker = new OpenApiWalker ( validator ) ;
81
85
walker . Walk ( parameter ) ;
82
86
@@ -91,7 +95,7 @@ public void ValidateExampleShouldNotHaveDataTypeMismatchForSimpleSchema()
91
95
} ) ;
92
96
errors . Select ( e => e . Pointer ) . Should ( ) . BeEquivalentTo ( new [ ]
93
97
{
94
- "#/example" ,
98
+ "#/{parameter1}/ example" ,
95
99
} ) ;
96
100
}
97
101
@@ -150,6 +154,7 @@ public void ValidateExamplesShouldNotHaveDataTypeMismatchForSimpleSchema()
150
154
151
155
// Act
152
156
var validator = new OpenApiValidator ( ValidationRuleSet . GetDefaultRuleSet ( ) ) ;
157
+ validator . Enter ( "{parameter1}" ) ;
153
158
var walker = new OpenApiWalker ( validator ) ;
154
159
walker . Walk ( parameter ) ;
155
160
@@ -168,9 +173,9 @@ public void ValidateExamplesShouldNotHaveDataTypeMismatchForSimpleSchema()
168
173
{
169
174
// #enum/0 is not an error since the spec allows
170
175
// representing an object using a string.
171
- "#/examples/example1/value/y" ,
172
- "#/examples/example1/value/z" ,
173
- "#/examples/example2/value"
176
+ "#/{parameter1}/ examples/example1/value/y" ,
177
+ "#/{parameter1}/ examples/example1/value/z" ,
178
+ "#/{parameter1}/ examples/example2/value"
174
179
} ) ;
175
180
}
176
181
@@ -193,7 +198,6 @@ public void PathParameterNotInThePathShouldReturnAnError()
193
198
194
199
// Act
195
200
var validator = new OpenApiValidator ( ValidationRuleSet . GetDefaultRuleSet ( ) ) ;
196
- validator . Enter ( "1" ) ;
197
201
198
202
var walker = new OpenApiWalker ( validator ) ;
199
203
walker . Walk ( parameter ) ;
@@ -209,7 +213,7 @@ public void PathParameterNotInThePathShouldReturnAnError()
209
213
} ) ;
210
214
errors . Select ( e => e . Pointer ) . Should ( ) . BeEquivalentTo ( new [ ]
211
215
{
212
- "#/1/ in"
216
+ "#/in"
213
217
} ) ;
214
218
}
215
219
0 commit comments