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