From b481000057dedb9eeaa3488c6bfa9d2bfad7b936 Mon Sep 17 00:00:00 2001 From: Joe Lauer Date: Wed, 25 Sep 2024 21:11:23 -0400 Subject: [PATCH] Jackson query param mapper exception messages improved --- .../fizzed/crux/jackson/QueryParamMapper.java | 20 +++++++++++++++- .../crux/jackson/QueryParamMapperTest.java | 23 ++++++++++++++++++- 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/crux-jackson/src/main/java/com/fizzed/crux/jackson/QueryParamMapper.java b/crux-jackson/src/main/java/com/fizzed/crux/jackson/QueryParamMapper.java index d522101..cf0718c 100644 --- a/crux-jackson/src/main/java/com/fizzed/crux/jackson/QueryParamMapper.java +++ b/crux-jackson/src/main/java/com/fizzed/crux/jackson/QueryParamMapper.java @@ -1,7 +1,9 @@ package com.fizzed.crux.jackson; +import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.ObjectReader; import com.fasterxml.jackson.databind.node.ArrayNode; import java.io.IOException; @@ -60,6 +62,10 @@ static public Map toQueryParams(ObjectMapper objectMapper, Object } static public T fromQueryParams(ObjectMapper objectMapper, Map params, Class type) throws IOException { + return fromQueryParams(objectMapper, params, type, false); + } + + static public T fromQueryParams(ObjectMapper objectMapper, Map params, Class type, boolean failOnUnknownProperties) throws IOException { // build a map of key -> values, where comma-delimited values are turned into lists final Map data = new HashMap<>(); @@ -76,7 +82,19 @@ static public T fromQueryParams(ObjectMapper objectMapper, Map