I'm going to attempt to do this by just creating a 
DisableAdditionalPropertiesMixin class that I can apply.  I'm not sure this 
will work and it kinda sucks because it means that the only way for it to 
work for everything is to apply this to every Object in the hierarchy.

Any other ideas here?


On Friday, September 9, 2016 at 6:07:47 PM UTC-4, Brent Ryan wrote:
>
> We're looking to see if there's a way to use the same model with 
> @JsonAnySetter jackson pattern for serialization to backend data storage, 
> while allowing us to use the same models for the inbound API requests that 
> are more strict.  So we want FAIL_ON_UNKNOWN_PROPERTIES set to true and 
> @JsonAnySetter to be disabled from the API perspective.
>
> Is there a way to do this or do you have to have 2 separate models or use 
> mix-ins?  Looking for the preferred approach to dealing with this.
>
> Example class:
>
> public class Data {
>
>   @JsonIgnore
>   private Map<String, Object> additionalProperties = new HashMap<String, 
> Object>();
>
>   @JsonAnyGetter
>   public Map<String, Object> getAdditionalProperties() {
>     return this.additionalProperties;
>   }
>
>   @JsonAnySetter
>   public void setAdditionalProperty(String name, Object value) {
>     this.additionalProperties.put(name, value);
>   }
>
> }
>
> Is there a way to disable a feature in ObjectMapper that turns off the 
> JsonAnySetter/JsonAnyGetter for 1 use case, but then enables it for others?
>

-- 
You received this message because you are subscribed to the Google Groups 
"jackson-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to