Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update jackson.version to v2.15.0 #5065

Merged
merged 2 commits into from
May 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
<!-- Lib versions - keep list sorted on property name -->
<geotools.version>29.0</geotools.version>
<google.dagger.version>2.45</google.dagger.version>
<jackson.version>2.14.2</jackson.version>
<jackson.version>2.15.0</jackson.version>
<jersey.version>3.1.1</jersey.version>
<junit.version>5.9.2</junit.version>
<micrometer.version>1.10.6</micrometer.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@ void geoJson() throws JsonProcessingException {

var jsonNode = ObjectMappers
.ignoringExtraFields()
.readTree(
"{\"type\":\"Polygon\",\"coordinates\":[[[0.0,0.0],[1.0,1.0],[2.0,2.0],[0.0,0.0]]]}"
);
assertEquals(jsonNode, geoJson);
.readTree("{\"type\":\"Polygon\",\"coordinates\":[[[0,0],[1,1],[2,2],[0,0]]]}");
assertEquals(jsonNode.toString(), geoJson.toString());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import au.com.origin.snapshots.serializers.SerializerType;
import au.com.origin.snapshots.serializers.SnapshotSerializer;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.util.DefaultIndenter;
Expand Down Expand Up @@ -37,6 +37,7 @@
import org.opentripplanner.TestOtpModel;
import org.opentripplanner.TestServerContext;
import org.opentripplanner.api.mapping.ItineraryMapper;
import org.opentripplanner.api.model.ApiLeg;
import org.opentripplanner.api.parameter.ApiRequestMode;
import org.opentripplanner.api.parameter.QualifiedMode;
import org.opentripplanner.api.parameter.Qualifier;
Expand Down Expand Up @@ -373,15 +374,7 @@ private SnapshotItinerarySerializer() {
objectMapper.registerModule(new JavaTimeModule());
objectMapper.registerModule(new Jdk8Module());

objectMapper.setVisibility(
objectMapper
.getSerializationConfig()
.getDefaultVisibilityChecker()
.withFieldVisibility(JsonAutoDetect.Visibility.ANY)
.withGetterVisibility(JsonAutoDetect.Visibility.NONE)
.withSetterVisibility(JsonAutoDetect.Visibility.NONE)
.withCreatorVisibility(JsonAutoDetect.Visibility.NONE)
);
objectMapper.addMixIn(ApiLeg.class, ApiLegMixin.class);

pp =
new DefaultPrettyPrinter("") {
Expand Down Expand Up @@ -418,4 +411,14 @@ public String getOutputFormat() {
return SerializerType.JSON.name();
}
}

/**
* To exclude {@link ApiLeg#getDuration()} from being deserialized because the returned number
* is non-constant making it impossible to assert.
*/
private abstract static class ApiLegMixin {

@JsonIgnore
abstract double getDuration();
}
}