GitHub user newkek opened a pull request:
https://github.com/apache/tinkerpop/pull/386
TINKERPOP-1274: GraphSON 2.0 [revised]
For context, a precise description is provided in the PR for the first
version of the fix: #351. Please see this first for initial context.
This PR provides initial set of features defined in #351, plus the
following:
- Types for Graph objects.
- Types for **all** numeric values.
- New type IDs format.
- Avoid serializing empty properties field.
As a reminder the format for types is the following:
- A value not typed : `value`
- A value typed : `{"@type":"typeName", "@value":value}`
## New type IDs format
A type ID is now composed of 2 parts, the "domain" and the type name. A
"domain" can be used by any implementor to implement their own data type,
avoiding collisions with the existing TinkerPop type IDs. The default domain
for Graph object is "gremlin".
## Types for all numeric values
A type is now present for every numeric value, the types have been renamed
to be more understandable with regards to their memory sizes or kinds. As a
reference, here is a description of all currently existing types and their
corresponding Java implementation:
- Java `Integer`: "gremlin:int32"
- Java `Long`: "gremlin:int64"
- Java `Short`: "gremlin:int16"
- Java `Float`: "gremlin:float"
- Java `Double`: "gremlin:double"
## Types for all Graph objects.
New typeIDs introduced in #351 (time types, UUIDs, etc..) now follow the
type format defined here: "domain:typename".
Types have now been included for Graph-specific objects, here is an
exhaustive list of the existing types handled so far and their corresponding
IDs:
- `Vertex` -> "gremlin:vertex"
- `Edge` -> "gremlin:edge"
- `VertexPropery` -> "gremlin:vertexproperty"
- `Property` -> "gremlin:property"
- `Path` -> "gremlin:path"
- `Tree` -> "gremlin:tree"
- `Graph` -> "gremlin:graph"
- `Metrics` -> "gremlin:metrics"
- `TraversalMetrics` -> `gremlin:traversalmetrics"
This improvement defines a requirement to the serialization format which is
that every type *must* have a Jackson serializer and deserializer defined on
the source `ObjectMapper`. Previous not defined serializers and deserializers
have been added in this PR.
Code-wise, it's pretty much the same than for #351, the big intake in code
here is the addition of the deserializers for all Graph objects, a big
simplification to the serializers (`GraphSONSerializersV2d0`), the addition of
the "domain" to the type system, and making that new typeID format configurable
to users through the `TinkerPopJacksonModule`.
`mvn clean install` test suite passes, and it's rebased on top of current
`master`.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/newkek/incubator-tinkerpop TINKERPOP-1274-rev
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/tinkerpop/pull/386.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #386
----
commit 635be59cf6505a47a1ca1d27519d07e918fdc1ef
Author: Stephen Mallette <[email protected]>
Date: 2016-05-18T12:41:26Z
TINKERPOP-1274: GraphSON 2.0.
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---