jackson-databind icon indicating copy to clipboard operation
jackson-databind copied to clipboard

Make @JacksonInject not fail when there's no corresponding value

Open retrodaredevil opened this issue 3 years ago • 1 comments

When something is annotated with @JacksonInject, if the ObjectMapper doesn't have injectable values set, it will fail with Caused by: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: No 'injectableValues' configured, cannot inject value with id [<name of injectable value>]. And there's a different error if the value doesn't exist on the injectable values object.

I'd like to be able to annotation things with @JacksonInject like so:

@JacksonInject(value = "myValue", optional = true)
private String myValue;

Additionally, there could also be a DeserializationFeature called something like FAIL_ON_UNKNOWN_INJECT_VALUE that defaults to true.

retrodaredevil avatar Mar 08 '21 03:03 retrodaredevil

+1

jtamm-red avatar Mar 31 '22 09:03 jtamm-red