Skip to content

Commit b091058

Browse files
authored
fix: Add missing extensions arg to constructors in new coercion tests (#49)
Tests added in the JSON Schema type-coercion fix used the pre-extensions record signatures and stopped compiling after the OpenAPI extensions feature merged into master.
1 parent 713f6de commit b091058

2 files changed

Lines changed: 19 additions & 8 deletions

File tree

src/test/java/com/retailsvc/http/internal/RequestPreparationFilterTest.java

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -164,14 +164,16 @@ void invalidQueryParamThrowsValidation() {
164164

165165
@Test
166166
void integerQueryParamIsCoercedFromStringBeforeValidation() throws Exception {
167-
var intSchema = new IntegerSchema(Set.of(TypeName.INTEGER), 1L, 100L, null, null, null, null);
167+
var intSchema =
168+
new IntegerSchema(Set.of(TypeName.INTEGER), 1L, 100L, null, null, null, null, Map.of());
168169
var op =
169170
new Operation(
170171
"a",
171172
HttpMethod.GET,
172173
PathTemplate.compile("/x"),
173174
Optional.empty(),
174175
List.of(new Parameter("n", Parameter.Location.QUERY, true, intSchema)),
176+
Map.of(),
175177
Map.of());
176178
Spec spec = specWith(op);
177179
Filter f = newFilter(spec);
@@ -184,14 +186,16 @@ void integerQueryParamIsCoercedFromStringBeforeValidation() throws Exception {
184186

185187
@Test
186188
void integerQueryParamRejectsNonNumericString() {
187-
var intSchema = new IntegerSchema(Set.of(TypeName.INTEGER), null, null, null, null, null, null);
189+
var intSchema =
190+
new IntegerSchema(Set.of(TypeName.INTEGER), null, null, null, null, null, null, Map.of());
188191
var op =
189192
new Operation(
190193
"a",
191194
HttpMethod.GET,
192195
PathTemplate.compile("/x"),
193196
Optional.empty(),
194197
List.of(new Parameter("n", Parameter.Location.QUERY, true, intSchema)),
198+
Map.of(),
195199
Map.of());
196200
Spec spec = specWith(op);
197201
Filter f = newFilter(spec);
@@ -205,14 +209,16 @@ void integerQueryParamRejectsNonNumericString() {
205209

206210
@Test
207211
void numberQueryParamIsCoercedFromStringBeforeValidation() throws Exception {
208-
var numSchema = new NumberSchema(Set.of(TypeName.NUMBER), null, null, null, null, null, null);
212+
var numSchema =
213+
new NumberSchema(Set.of(TypeName.NUMBER), null, null, null, null, null, null, Map.of());
209214
var op =
210215
new Operation(
211216
"a",
212217
HttpMethod.GET,
213218
PathTemplate.compile("/x"),
214219
Optional.empty(),
215220
List.of(new Parameter("n", Parameter.Location.QUERY, true, numSchema)),
221+
Map.of(),
216222
Map.of());
217223
Spec spec = specWith(op);
218224
Filter f = newFilter(spec);
@@ -225,14 +231,16 @@ void numberQueryParamIsCoercedFromStringBeforeValidation() throws Exception {
225231

226232
@Test
227233
void numberQueryParamRejectsNonNumericString() {
228-
var numSchema = new NumberSchema(Set.of(TypeName.NUMBER), null, null, null, null, null, null);
234+
var numSchema =
235+
new NumberSchema(Set.of(TypeName.NUMBER), null, null, null, null, null, null, Map.of());
229236
var op =
230237
new Operation(
231238
"a",
232239
HttpMethod.GET,
233240
PathTemplate.compile("/x"),
234241
Optional.empty(),
235242
List.of(new Parameter("n", Parameter.Location.QUERY, true, numSchema)),
243+
Map.of(),
236244
Map.of());
237245
Spec spec = specWith(op);
238246
Filter f = newFilter(spec);
@@ -246,14 +254,15 @@ void numberQueryParamRejectsNonNumericString() {
246254

247255
@Test
248256
void booleanQueryParamCoercesTrueAndFalse() throws Exception {
249-
var boolSchema = new BooleanSchema(Set.of(TypeName.BOOLEAN));
257+
var boolSchema = new BooleanSchema(Set.of(TypeName.BOOLEAN), Map.of());
250258
var op =
251259
new Operation(
252260
"a",
253261
HttpMethod.GET,
254262
PathTemplate.compile("/x"),
255263
Optional.empty(),
256264
List.of(new Parameter("b", Parameter.Location.QUERY, true, boolSchema)),
265+
Map.of(),
257266
Map.of());
258267
Spec spec = specWith(op);
259268
Filter f = newFilter(spec);
@@ -270,14 +279,15 @@ void booleanQueryParamCoercesTrueAndFalse() throws Exception {
270279

271280
@Test
272281
void booleanQueryParamRejectsNonBooleanString() {
273-
var boolSchema = new BooleanSchema(Set.of(TypeName.BOOLEAN));
282+
var boolSchema = new BooleanSchema(Set.of(TypeName.BOOLEAN), Map.of());
274283
var op =
275284
new Operation(
276285
"a",
277286
HttpMethod.GET,
278287
PathTemplate.compile("/x"),
279288
Optional.empty(),
280289
List.of(new Parameter("b", Parameter.Location.QUERY, true, boolSchema)),
290+
Map.of(),
281291
Map.of());
282292
Spec spec = specWith(op);
283293
Filter f = newFilter(spec);

src/test/java/com/retailsvc/http/validate/StringIntegerNumberTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,15 +349,16 @@ void numberFormatUnknownIsIgnored() {
349349
@Test
350350
void integerRejectsNumericLookingString() {
351351
IntegerSchema s =
352-
new IntegerSchema(Set.of(TypeName.INTEGER), null, null, null, null, null, null);
352+
new IntegerSchema(Set.of(TypeName.INTEGER), null, null, null, null, null, null, Map.of());
353353
assertThatThrownBy(() -> v.validate("42", s, "/v"))
354354
.extracting(t -> ((ValidationException) t).error().keyword())
355355
.isEqualTo("type");
356356
}
357357

358358
@Test
359359
void numberRejectsNumericLookingString() {
360-
NumberSchema s = new NumberSchema(Set.of(TypeName.NUMBER), null, null, null, null, null, null);
360+
NumberSchema s =
361+
new NumberSchema(Set.of(TypeName.NUMBER), null, null, null, null, null, null, Map.of());
361362
assertThatThrownBy(() -> v.validate("1234567890", s, "/v"))
362363
.extracting(t -> ((ValidationException) t).error().keyword())
363364
.isEqualTo("type");

0 commit comments

Comments
 (0)