From 10e089dae76fdea11cc4676105bb95af3955ea1a Mon Sep 17 00:00:00 2001 From: Thomas Cederholm Date: Tue, 12 May 2026 10:57:40 +0200 Subject: [PATCH] fix: Add missing extensions arg to constructors in new coercion tests 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. --- .../RequestPreparationFilterTest.java | 22 ++++++++++++++----- .../validate/StringIntegerNumberTest.java | 5 +++-- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/test/java/com/retailsvc/http/internal/RequestPreparationFilterTest.java b/src/test/java/com/retailsvc/http/internal/RequestPreparationFilterTest.java index 2760dbf..429f98c 100644 --- a/src/test/java/com/retailsvc/http/internal/RequestPreparationFilterTest.java +++ b/src/test/java/com/retailsvc/http/internal/RequestPreparationFilterTest.java @@ -164,7 +164,8 @@ void invalidQueryParamThrowsValidation() { @Test void integerQueryParamIsCoercedFromStringBeforeValidation() throws Exception { - var intSchema = new IntegerSchema(Set.of(TypeName.INTEGER), 1L, 100L, null, null, null, null); + var intSchema = + new IntegerSchema(Set.of(TypeName.INTEGER), 1L, 100L, null, null, null, null, Map.of()); var op = new Operation( "a", @@ -172,6 +173,7 @@ void integerQueryParamIsCoercedFromStringBeforeValidation() throws Exception { PathTemplate.compile("/x"), Optional.empty(), List.of(new Parameter("n", Parameter.Location.QUERY, true, intSchema)), + Map.of(), Map.of()); Spec spec = specWith(op); Filter f = newFilter(spec); @@ -184,7 +186,8 @@ void integerQueryParamIsCoercedFromStringBeforeValidation() throws Exception { @Test void integerQueryParamRejectsNonNumericString() { - var intSchema = new IntegerSchema(Set.of(TypeName.INTEGER), null, null, null, null, null, null); + var intSchema = + new IntegerSchema(Set.of(TypeName.INTEGER), null, null, null, null, null, null, Map.of()); var op = new Operation( "a", @@ -192,6 +195,7 @@ void integerQueryParamRejectsNonNumericString() { PathTemplate.compile("/x"), Optional.empty(), List.of(new Parameter("n", Parameter.Location.QUERY, true, intSchema)), + Map.of(), Map.of()); Spec spec = specWith(op); Filter f = newFilter(spec); @@ -205,7 +209,8 @@ void integerQueryParamRejectsNonNumericString() { @Test void numberQueryParamIsCoercedFromStringBeforeValidation() throws Exception { - var numSchema = new NumberSchema(Set.of(TypeName.NUMBER), null, null, null, null, null, null); + var numSchema = + new NumberSchema(Set.of(TypeName.NUMBER), null, null, null, null, null, null, Map.of()); var op = new Operation( "a", @@ -213,6 +218,7 @@ void numberQueryParamIsCoercedFromStringBeforeValidation() throws Exception { PathTemplate.compile("/x"), Optional.empty(), List.of(new Parameter("n", Parameter.Location.QUERY, true, numSchema)), + Map.of(), Map.of()); Spec spec = specWith(op); Filter f = newFilter(spec); @@ -225,7 +231,8 @@ void numberQueryParamIsCoercedFromStringBeforeValidation() throws Exception { @Test void numberQueryParamRejectsNonNumericString() { - var numSchema = new NumberSchema(Set.of(TypeName.NUMBER), null, null, null, null, null, null); + var numSchema = + new NumberSchema(Set.of(TypeName.NUMBER), null, null, null, null, null, null, Map.of()); var op = new Operation( "a", @@ -233,6 +240,7 @@ void numberQueryParamRejectsNonNumericString() { PathTemplate.compile("/x"), Optional.empty(), List.of(new Parameter("n", Parameter.Location.QUERY, true, numSchema)), + Map.of(), Map.of()); Spec spec = specWith(op); Filter f = newFilter(spec); @@ -246,7 +254,7 @@ void numberQueryParamRejectsNonNumericString() { @Test void booleanQueryParamCoercesTrueAndFalse() throws Exception { - var boolSchema = new BooleanSchema(Set.of(TypeName.BOOLEAN)); + var boolSchema = new BooleanSchema(Set.of(TypeName.BOOLEAN), Map.of()); var op = new Operation( "a", @@ -254,6 +262,7 @@ void booleanQueryParamCoercesTrueAndFalse() throws Exception { PathTemplate.compile("/x"), Optional.empty(), List.of(new Parameter("b", Parameter.Location.QUERY, true, boolSchema)), + Map.of(), Map.of()); Spec spec = specWith(op); Filter f = newFilter(spec); @@ -270,7 +279,7 @@ void booleanQueryParamCoercesTrueAndFalse() throws Exception { @Test void booleanQueryParamRejectsNonBooleanString() { - var boolSchema = new BooleanSchema(Set.of(TypeName.BOOLEAN)); + var boolSchema = new BooleanSchema(Set.of(TypeName.BOOLEAN), Map.of()); var op = new Operation( "a", @@ -278,6 +287,7 @@ void booleanQueryParamRejectsNonBooleanString() { PathTemplate.compile("/x"), Optional.empty(), List.of(new Parameter("b", Parameter.Location.QUERY, true, boolSchema)), + Map.of(), Map.of()); Spec spec = specWith(op); Filter f = newFilter(spec); diff --git a/src/test/java/com/retailsvc/http/validate/StringIntegerNumberTest.java b/src/test/java/com/retailsvc/http/validate/StringIntegerNumberTest.java index a87eddf..fc5d5b1 100644 --- a/src/test/java/com/retailsvc/http/validate/StringIntegerNumberTest.java +++ b/src/test/java/com/retailsvc/http/validate/StringIntegerNumberTest.java @@ -349,7 +349,7 @@ void numberFormatUnknownIsIgnored() { @Test void integerRejectsNumericLookingString() { IntegerSchema s = - new IntegerSchema(Set.of(TypeName.INTEGER), null, null, null, null, null, null); + new IntegerSchema(Set.of(TypeName.INTEGER), null, null, null, null, null, null, Map.of()); assertThatThrownBy(() -> v.validate("42", s, "/v")) .extracting(t -> ((ValidationException) t).error().keyword()) .isEqualTo("type"); @@ -357,7 +357,8 @@ void integerRejectsNumericLookingString() { @Test void numberRejectsNumericLookingString() { - NumberSchema s = new NumberSchema(Set.of(TypeName.NUMBER), null, null, null, null, null, null); + NumberSchema s = + new NumberSchema(Set.of(TypeName.NUMBER), null, null, null, null, null, null, Map.of()); assertThatThrownBy(() -> v.validate("1234567890", s, "/v")) .extracting(t -> ((ValidationException) t).error().keyword()) .isEqualTo("type");