target.put(sModelEntry.getKey(), sModelEntry.getValue());
} else {
//we can encounter a known model with an unknown property
//if (de)serialization is not symmetrical (@JsonIgnore on setter, @JsonProperty on getter).
//In these cases, don't overwrite the entire model entry for that type, just add the unknown property.
Model targetModelValue = target.get(sourceModelKey);
Model sourceModelValue = sModelEntry.getValue();
Map<String, ModelProperty> targetProperties = fromScalaMap(targetModelValue.properties());
Map<String, ModelProperty> sourceProperties = fromScalaMap(sourceModelValue.properties());
Set<String> newSourcePropKeys = newHashSet(sourceProperties.keySet());
newSourcePropKeys.removeAll(targetProperties.keySet());
Map<String, ModelProperty> mergedTargetProperties = Maps.newHashMap(targetProperties);
for (String newProperty : newSourcePropKeys) {
mergedTargetProperties.put(newProperty, sourceProperties.get(newProperty));
}
// uses scala generated copy constructor.
Model mergedModel = targetModelValue.copy(
targetModelValue.id(),
targetModelValue.name(),
targetModelValue.qualifiedType(),
ScalaConverters.toScalaLinkedHashMap(mergedTargetProperties),
targetModelValue.description(),