Skip to content
This repository has been archived by the owner on May 26, 2020. It is now read-only.

configured object mapper to not fail if unexpected properties are found #25

Merged
merged 1 commit into from
Jul 20, 2018

Conversation

robindevilliers
Copy link
Contributor

Well...

Its practice now to set 'allowaddtionalProperties=true' in all our schemas. Unfortunately, the currently configured ObjectMapperProducer's configuration is not in accord with this policy.

@coveralls
Copy link

coveralls commented Jul 18, 2018

Coverage Status

Coverage increased (+0.004%) to 98.563% when pulling c020d5c on tolerate-additional-properties into e9fe5c6 on master.

@@ -275,7 +285,8 @@ public String toString() {
private final int age;
private final Colour favouriteColour;

public Person(final String name, final int age, final Colour favouriteColour) {
@JsonCreator
public Person(@JsonProperty("name") final String name, @JsonProperty("age") final int age, @JsonProperty("favouriteColour") final Colour favouriteColour) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't need these annotations - in fact, adding them means that we are not testing that the object mapper works without them. If you're finding the tests fail withoout them when running from your IDE, ist probably because you haven't got the "-parameters" compiler option turned on.


public PersonWithAdditionalProperties(final String name, final int age, final Map<String, Object> additionalProperties) {
@JsonCreator
public PersonWithAdditionalProperties(@JsonProperty("name") final String name, @JsonProperty("age") final int age, final Map<String, Object> additionalProperties) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above

@purple52 purple52 force-pushed the tolerate-additional-properties branch from a2f225a to c020d5c Compare July 20, 2018 15:21
@purple52 purple52 merged commit 457f5d5 into master Jul 20, 2018
@purple52 purple52 deleted the tolerate-additional-properties branch July 20, 2018 15:34
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants