Made GraphSON 3.0 the default config in GraphSONMapper
This change should have been made back when we moved 3.0 to the default earlier with Gremlin Server. CTR
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index e3df862..1d6e808 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -42,6 +42,7 @@
* Refactored `Traversal` semantics to always expect `EmptyStep` as a parent if it is meant to be the root `Traversal`.
* Configured GraphBinary as the default binary serialization format for the Java Driver.
* Configured GraphSON 3.0 as the default text serialization format when no serializer can be determined.
+* Configured GraphSON 3.0 as the default setting for the `GraphSONMapper`.
* Bump to Neo4j 3.4.11.
* Added a parameterized `TypeTranslator` for use with `GroovyTranslator` that should produce more cache hits.
* Added support for `TextP` in Neo4j using its string search functions.
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONMapper.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONMapper.java
index 30112f9..bfa239b 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONMapper.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONMapper.java
@@ -198,7 +198,7 @@
private boolean loadCustomModules = false;
private boolean normalize = false;
private List<IoRegistry> registries = new ArrayList<>();
- private GraphSONVersion version = GraphSONVersion.V2_0;
+ private GraphSONVersion version = GraphSONVersion.V3_0;
/**
* GraphSON 2.0/3.0 should have types activated by default (3.0 does not have a typeless option), and 1.0
@@ -219,7 +219,7 @@
}
/**
- * Set the version of GraphSON to use. The default is {@link GraphSONVersion#V2_0}.
+ * Set the version of GraphSON to use. The default is {@link GraphSONVersion#V3_0}.
*/
public Builder version(final GraphSONVersion version) {
this.version = version;
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/LegacyGraphSONReader.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/LegacyGraphSONReader.java
index 3125e73..7432e22 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/LegacyGraphSONReader.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/LegacyGraphSONReader.java
@@ -205,7 +205,6 @@
private boolean loadCustomModules = false;
private List<SimpleModule> customModules = new ArrayList<>();
private long batchSize = 10000;
- private boolean embedTypes = false;
private Builder() {
}
@@ -236,9 +235,12 @@
}
public LegacyGraphSONReader create() {
- final GraphSONMapper.Builder builder = GraphSONMapper.build();
+ // not sure why there is specific need for V2 here with "no types" as we don't even need TP3 GraphSON
+ // at all. Seems like a standard Jackson ObjectMapper would have worked fine, but rather than change
+ // this ancient class at this stage we'll just stick to what is there.
+ final GraphSONMapper.Builder builder = GraphSONMapper.build().version(GraphSONVersion.V2_0);
customModules.forEach(builder::addCustomModule);
- final GraphSONMapper mapper = builder.typeInfo(embedTypes ? TypeInfo.PARTIAL_TYPES : TypeInfo.NO_TYPES)
+ final GraphSONMapper mapper = builder.typeInfo(TypeInfo.NO_TYPES)
.loadCustomModules(loadCustomModules).create();
return new LegacyGraphSONReader(mapper.createMapper(), batchSize);
}