You have registries for each version as well and default to v3. Please see
TinkerGraph:

https://github.com/apache/tinkerpop/blob/master/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java#L198

If the user wants to override that then that's their choice, but they have
to rig it all up. We probably need a better system than this. IO is way too
complicated and confusing.

On Tue, Sep 5, 2017 at 9:52 AM, pieter gmail <pieter.mar...@gmail.com>
wrote:

> Afraid I still don't quite get it. How do I register the different
> SimpleModules depending on the version.
>
> Currently it starts in SqlgGraph,
>
> @Override
> public <I extends Io> I io(final Io.Builder<I> builder) {
>     return (I) builder.graph(this).onMapper(mapper ->
> mapper.addRegistry(SqlgIoRegistry.getInstance())).create();
> }
>
> and the SqlgIoRegistry registers the SimpleModule
>
> private SqlgIoRegistry() {
>     final SqlgSimpleModule sqlgSimpleModule = new SqlgSimpleModule();
>     register(GraphSONIo.class, null, sqlgSimpleModule);
>     register(GryoIo.class, RecordId.class, null);
> }
>
>
> Is the SqlgGraph.io(...) method suppose to interrogate the builder to
> check the version and add a corresponding IoRegistry and SimpleModule?
>
> Thanks
> Pieter
>
>
>
>
>
>
> On 05/09/2017 13:30, Stephen Mallette wrote:
>
>> I think you should just create a new SimpleModule for each version - don't
>> try to put them in the same SqlgSimpleModule. It's a naming convention
>> that
>> users will have to follow rather than something explicitly enforced
>> through
>> code.
>>
>> On Sun, Sep 3, 2017 at 3:20 PM, pieter gmail <pieter.mar...@gmail.com>
>> wrote:
>>
>> Hi,
>>>
>>> I am getting IO tests failures on 3.3.0.
>>>
>>> Sqlg has a SimpleModule which add serializers for its custom id.
>>>
>>>      SqlgSimpleModule() {
>>>          super("custom");
>>> //        addSerializer(RecordId.class, new
>>> RecordId.RecordIdJacksonSerial
>>> izerV2d0());
>>> //        addDeserializer(RecordId.class, new
>>> RecordId.RecordIdJacksonDeserializerV2d0());
>>> //        addSerializer(SchemaTable.class, new
>>> SchemaTable.SchemaTableIdJacksonSerializerV2d0());
>>> //        addDeserializer(SchemaTable.class, new
>>> SchemaTable.SchemaTableIdJacksonDeserializerV2d0());
>>>
>>>          addSerializer(RecordId.class, new RecordId.RecordIdJacksonSerial
>>> izerV3d0());
>>>          addDeserializer(RecordId.class, new
>>> RecordId.RecordIdJacksonDeseri
>>> alizerV3d0());
>>>          addSerializer(SchemaTable.class, new
>>> SchemaTable.SchemaTableJacksonSerializerV3d0());
>>>          addDeserializer(SchemaTable.class, new
>>> SchemaTable.SchemaTableJacksonDeserializerV3d0());
>>>      }
>>>
>>> How is it suppose to distinguish between v2 and v3?
>>>
>>> An example of a failure is 'IoEdgeTest.shouldReadWriteEdge'
>>>
>>> If ...V2d0.. is added to the serializers then 'graphson-v3' fails.
>>> If ...V3d0.. is added to the serializers then 'graphson-v2' fails.
>>>
>>> TinkerPop's own CustomId tests do not rely on default behavior and
>>> manually creates SimpleModules for each scenario.
>>>
>>> Are they both suppose to work somehow?
>>>
>>> Thanks
>>> Pieter
>>>
>>>
>

Reply via email to