You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by xi...@apache.org on 2026/03/27 01:16:14 UTC
(tinkerpop) branch remove-graphson-dnet created (now f1e6ce71f5)
This is an automated email from the ASF dual-hosted git repository.
xiazcy pushed a change to branch remove-graphson-dnet
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
at f1e6ce71f5 Remove Lambda classes and GraphSON from .Net as only GraphBinary is kept in 4.0
This branch includes the following new commits:
new f1e6ce71f5 Remove Lambda classes and GraphSON from .Net as only GraphBinary is kept in 4.0
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(tinkerpop) 01/01: Remove Lambda classes and GraphSON from .Net as only GraphBinary is kept in 4.0
Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
xiazcy pushed a commit to branch remove-graphson-dnet
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
commit f1e6ce71f526aac396504b1dfb25373a864f1da2
Author: Yang Xia <xi...@gmail.com>
AuthorDate: Thu Mar 26 18:16:01 2026 -0700
Remove Lambda classes and GraphSON from .Net as only GraphBinary is kept in 4.0
---
.../src/Gremlin.Net/Process/Traversal/Lambda.cs | 84 ---
.../Process/Traversal/StringBasedLambda.cs | 61 --
.../IO/GraphSON/BigIntegerDeserializer.cs | 39 --
.../Structure/IO/GraphSON/BigIntegerSerializer.cs | 37 --
.../Structure/IO/GraphSON/BulkSetSerializer.cs | 48 --
.../IO/GraphSON/ByteBufferDeserializer.cs | 38 --
.../Structure/IO/GraphSON/ByteBufferSerializer.cs | 36 --
.../Structure/IO/GraphSON/CharConverter.cs | 39 --
.../Structure/IO/GraphSON/ClassSerializer.cs | 47 --
.../Structure/IO/GraphSON/DTDeserializer.cs | 38 --
.../Structure/IO/GraphSON/DateDeserializer.cs | 38 --
.../Structure/IO/GraphSON/DecimalConverter.cs | 46 --
.../Structure/IO/GraphSON/DirectionDeserializer.cs | 39 --
.../Structure/IO/GraphSON/DoubleConverter.cs | 72 ---
.../Structure/IO/GraphSON/DurationDeserializer.cs | 40 --
.../Structure/IO/GraphSON/DurationSerializer.cs | 38 --
.../Structure/IO/GraphSON/EdgeDeserializer.cs | 60 --
.../Structure/IO/GraphSON/EdgeSerializer.cs | 45 --
.../Structure/IO/GraphSON/EnumSerializer.cs | 37 --
.../Structure/IO/GraphSON/FloatConverter.cs | 33 -
.../Structure/IO/GraphSON/GTypeDeserializer.cs | 38 --
.../IO/GraphSON/GraphSON2MessageSerializer.cs | 41 --
.../Structure/IO/GraphSON/GraphSON2Reader.cs | 50 --
.../Structure/IO/GraphSON/GraphSON2Writer.cs | 51 --
.../IO/GraphSON/GraphSON3MessageSerializer.cs | 41 --
.../Structure/IO/GraphSON/GraphSON3Reader.cs | 68 --
.../Structure/IO/GraphSON/GraphSON3Writer.cs | 68 --
.../IO/GraphSON/GraphSONMessageSerializer.cs | 88 ---
.../Structure/IO/GraphSON/GraphSONReader.cs | 153 -----
.../Structure/IO/GraphSON/GraphSONTokens.cs | 32 -
.../Structure/IO/GraphSON/GraphSONUtil.cs | 83 ---
.../Structure/IO/GraphSON/GraphSONWriter.cs | 177 ------
.../Structure/IO/GraphSON/IGraphSONDeserializer.cs | 41 --
.../Structure/IO/GraphSON/IGraphSONSerializer.cs | 41 --
.../Structure/IO/GraphSON/Int16Converter.cs | 35 -
.../Structure/IO/GraphSON/Int32Converter.cs | 34 -
.../Structure/IO/GraphSON/Int64Converter.cs | 34 -
.../Structure/IO/GraphSON/LambdaSerializer.cs | 43 --
.../Structure/IO/GraphSON/ListSerializer.cs | 54 --
.../Structure/IO/GraphSON/MapSerializer.cs | 64 --
.../Structure/IO/GraphSON/MergeDeserializer.cs | 38 --
.../Structure/IO/GraphSON/NumberConverter.cs | 56 --
.../IO/GraphSON/OffsetDateTimeDeserializer.cs | 37 --
.../IO/GraphSON/OffsetDateTimeSerializer.cs | 37 --
.../Structure/IO/GraphSON/PSerializer.cs | 45 --
.../Structure/IO/GraphSON/Path3Deserializer.cs | 47 --
.../Structure/IO/GraphSON/PathDeserializer.cs | 46 --
.../Structure/IO/GraphSON/PropertyDeserializer.cs | 40 --
.../Structure/IO/GraphSON/PropertySerializer.cs | 67 --
.../IO/GraphSON/RequestMessageSerializer.cs | 41 --
.../Structure/IO/GraphSON/SByteConverter.cs | 33 -
.../Structure/IO/GraphSON/SetSerializer.cs | 47 --
.../Structure/IO/GraphSON/TDeserializer.cs | 38 --
.../Structure/IO/GraphSON/TextPSerializer.cs | 45 --
.../Structure/IO/GraphSON/TraversalSerializer.cs | 37 --
.../IO/GraphSON/TraversalStrategySerializer.cs | 42 --
.../Structure/IO/GraphSON/TraverserReader.cs | 38 --
.../Structure/IO/GraphSON/UuidDeserializer.cs | 39 --
.../Structure/IO/GraphSON/UuidSerializer.cs | 37 --
.../Structure/IO/GraphSON/VertexDeserializer.cs | 51 --
.../IO/GraphSON/VertexPropertyDeserializer.cs | 50 --
.../IO/GraphSON/VertexPropertySerializer.cs | 46 --
.../Structure/IO/GraphSON/VertexSerializer.cs | 41 --
.../Structure/IO/SerializationTokens.cs | 18 +-
.../Docs/Dev/Provider/IndexTests.cs | 91 ---
.../Docs/Reference/GremlinVariantsTests.cs | 17 -
.../Driver/PropertyDeserializationTests.cs | 13 -
.../GraphTraversalSourceTests.cs | 11 -
.../Process/Traversal/GraphSONWriterTests.cs | 64 --
.../Driver/GraphSONMessageSerializerTests.cs | 83 ---
.../IO/GraphSON/GraphSON3MessageSerializerTests.cs | 58 --
.../Structure/IO/GraphSON/GraphSONReaderTests.cs | 708 ---------------------
.../Structure/IO/GraphSON/GraphSONWriterTests.cs | 641 -------------------
.../Structure/IO/GraphSON/TestClass.cs | 30 -
.../Structure/IO/GraphSON/TestUtils.cs | 36 --
75 files changed, 2 insertions(+), 4917 deletions(-)
diff --git a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Lambda.cs b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Lambda.cs
deleted file mode 100644
index a441ea240c..0000000000
--- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Lambda.cs
+++ /dev/null
@@ -1,84 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#endregion
-
-namespace Gremlin.Net.Process.Traversal
-{
- /// <summary>
- /// Represents a lambda.
- /// </summary>
- public interface ILambda : IFunction, IBiFunction, IPredicate, IUnaryOperator, IBinaryOperator, IComparator,
- IConsumer, ISupplier
- {
- /// <summary>
- /// Gets the lambda expression.
- /// </summary>
- string LambdaExpression { get; }
-
- /// <summary>
- /// Gets the language of this lambda.
- /// </summary>
- string Language { get; }
-
- /// <summary>
- /// Gets the arguments of this lambda.
- /// </summary>
- int Arguments { get; }
- }
-
- /// <summary>
- /// Provides methods to create lambdas.
- /// </summary>
- public static class Lambda
- {
- /// <summary>
- /// Creates a new Groovy lambda.
- /// </summary>
- /// <param name="expression">The lambda expression.</param>
- /// <returns>The created lambda.</returns>
- public static ILambda Groovy(string expression)
- {
- return new GroovyStringBasedLambda(expression);
- }
-
- /// <summary>
- /// Creates a new Groovy lambda with the specified number of lambda arguments.
- /// </summary>
- /// <param name="expression">The lambda expression.</param>
- /// <param name="arguments">The number of lambda arguments.</param>
- /// <returns>The created lambda.</returns>
- public static ILambda Groovy(string expression, int arguments)
- {
- return new GroovyStringBasedLambda(expression, arguments);
- }
-
- /// <summary>
- /// Creates a new Python lambda.
- /// </summary>
- /// <param name="expression">The lambda expression.</param>
- /// <returns>The created lambda.</returns>
- public static ILambda Python(string expression)
- {
- return new StringBasedLambda(expression, "gremlin-python");
- }
- }
-}
\ No newline at end of file
diff --git a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/StringBasedLambda.cs b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/StringBasedLambda.cs
deleted file mode 100644
index 72e76f41f1..0000000000
--- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/StringBasedLambda.cs
+++ /dev/null
@@ -1,61 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#endregion
-
-using System;
-
-namespace Gremlin.Net.Process.Traversal
-{
- internal class StringBasedLambda : ILambda
- {
- private const int DefaultArgument = -1;
-
- public StringBasedLambda(string expression, string language)
- {
- LambdaExpression = expression;
- Language = language;
- }
-
- public string LambdaExpression { get; }
-
- public string Language { get; }
-
- public int Arguments { get; protected set; } = DefaultArgument;
- }
-
- internal class GroovyStringBasedLambda : StringBasedLambda
- {
- public GroovyStringBasedLambda(string expression) : base(expression, "gremlin-groovy")
- {
- // try to detect 1 or 2 argument lambda if possible otherwise go with unknown which is the default
- if (!expression.Contains("->")) return;
- var args = expression.Substring(0, expression.IndexOf("->", StringComparison.Ordinal));
- Arguments = args.Contains(",") ? 2 : 1;
- }
-
- public GroovyStringBasedLambda(string expression, int arguments) : base(expression, "gremlin-groovy")
- {
- Arguments = arguments;
- }
-
- }
-}
\ No newline at end of file
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/BigIntegerDeserializer.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/BigIntegerDeserializer.cs
deleted file mode 100644
index a34aed9d53..0000000000
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/BigIntegerDeserializer.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#endregion
-
-using System.IO;
-using System.Numerics;
-using System.Text.Json;
-
-namespace Gremlin.Net.Structure.IO.GraphSON
-{
- internal class BigIntegerDeserializer : IGraphSONDeserializer
- {
- public dynamic Objectify(JsonElement graphson, GraphSONReader reader)
- {
- var bigInteger = graphson.ValueKind == JsonValueKind.String ? graphson.GetString() : graphson.GetRawText();
- if (bigInteger == null) throw new IOException("Read null, but expected a BigInteger string representation");
- return BigInteger.Parse(bigInteger);
- }
- }
-}
\ No newline at end of file
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/BigIntegerSerializer.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/BigIntegerSerializer.cs
deleted file mode 100644
index e0b3f409b9..0000000000
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/BigIntegerSerializer.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#endregion
-
-using System.Collections.Generic;
-using System.Numerics;
-
-namespace Gremlin.Net.Structure.IO.GraphSON
-{
- internal class BigIntegerSerializer : IGraphSONSerializer
- {
- public Dictionary<string, dynamic> Dictify(dynamic objectData, GraphSONWriter writer)
- {
- BigInteger value = objectData;
- return GraphSONUtil.ToTypedValue("BigInteger", value.ToString(), "gx");
- }
- }
-}
\ No newline at end of file
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/BulkSetSerializer.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/BulkSetSerializer.cs
deleted file mode 100644
index a5108212f9..0000000000
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/BulkSetSerializer.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#endregion
-
-using System.Collections.Generic;
-using System.Linq;
-using System.Text.Json;
-
-namespace Gremlin.Net.Structure.IO.GraphSON
-{
- internal class BulkSetSerializer : IGraphSONDeserializer
- {
- public dynamic Objectify(JsonElement graphsonObject, GraphSONReader reader)
- {
- if (graphsonObject.ValueKind != JsonValueKind.Array)
- {
- return new List<object>(0);
- }
-
- // coerce the BulkSet to List. if the bulk exceeds the int space then we can't coerce to List anyway,
- // so this query will be trouble. we'd need a legit BulkSet implementation here in C#. this current
- // implementation is here to replicate the previous functionality that existed on the server side in
- // previous versions.
- return Enumerable.Range(0, graphsonObject.GetArrayLength() / 2).SelectMany<int, object>(i =>
- Enumerable.Repeat<object>(reader.ToObject(graphsonObject[i * 2]),
- (int) reader.ToObject(graphsonObject[i * 2 + 1])!)).ToList();
- }
- }
-}
\ No newline at end of file
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/ByteBufferDeserializer.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/ByteBufferDeserializer.cs
deleted file mode 100644
index c01b17a010..0000000000
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/ByteBufferDeserializer.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-#endregion
-
-using System;
-using System.IO;
-using System.Text.Json;
-
-namespace Gremlin.Net.Structure.IO.GraphSON
-{
- internal class ByteBufferDeserializer : IGraphSONDeserializer
- {
- public dynamic Objectify(JsonElement graphsonObject, GraphSONReader reader)
- {
- var base64String = graphsonObject.GetString();
- return Convert.FromBase64String(base64String ??
- throw new IOException("Read null but expected a base64 byte string"));
- }
- }
-}
\ No newline at end of file
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/ByteBufferSerializer.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/ByteBufferSerializer.cs
deleted file mode 100644
index b9f7e98e53..0000000000
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/ByteBufferSerializer.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-#endregion
-
-using System;
-using System.Collections.Generic;
-
-namespace Gremlin.Net.Structure.IO.GraphSON
-{
- internal class ByteBufferSerializer : IGraphSONSerializer
- {
- public Dictionary<string, dynamic> Dictify(dynamic objectData, GraphSONWriter writer)
- {
- byte[] value = objectData;
- return GraphSONUtil.ToTypedValue("ByteBuffer", Convert.ToBase64String(value), "gx");
- }
- }
-}
\ No newline at end of file
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/CharConverter.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/CharConverter.cs
deleted file mode 100644
index ada050fa1f..0000000000
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/CharConverter.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-#endregion
-
-using System.IO;
-using System.Text.Json;
-
-namespace Gremlin.Net.Structure.IO.GraphSON
-{
- internal class CharConverter : NumberConverter<char>
- {
- protected override string GraphSONTypeName => "Char";
- protected override string Prefix => "gx";
- protected override bool StringifyValue => true;
- protected override dynamic FromJsonElement(JsonElement graphson)
- {
- var deserializedByte = graphson.GetString() ?? throw new IOException("Read null but expected a string");
- return deserializedByte[0];
- }
- }
-}
\ No newline at end of file
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/ClassSerializer.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/ClassSerializer.cs
deleted file mode 100644
index d5df386f42..0000000000
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/ClassSerializer.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#endregion
-
-using System;
-using System.Collections.Generic;
-using System.IO;
-
-namespace Gremlin.Net.Structure.IO.GraphSON
-{
- internal class ClassSerializer : IGraphSONSerializer
- {
- public Dictionary<string, dynamic> Dictify(dynamic objectData, GraphSONWriter writer)
- {
- var type = (Type) objectData;
-
- // try to create the Type and then access the Fqcn property. if that's not there then
- // throw an exception
- var instance = Activator.CreateInstance(type)
- ?? throw new IOException($"Cannot create an instance of {type.FullName}");
- var fqcnProperty = type.GetProperty("Fqcn")
- ?? throw new IOException($"The type {type.FullName} does not have a 'Fqcn' property");
- var fqcnValue = fqcnProperty.GetValue(instance)
- ?? throw new IOException($"The 'Fqcn' property of {type.FullName} is null");
- return GraphSONUtil.ToTypedValue("Class", fqcnValue);
- }
- }
-}
\ No newline at end of file
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/DTDeserializer.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/DTDeserializer.cs
deleted file mode 100644
index 9c69ffef22..0000000000
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/DTDeserializer.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#endregion
-
-using System.IO;
-using System.Text.Json;
-using Gremlin.Net.Process.Traversal;
-
-namespace Gremlin.Net.Structure.IO.GraphSON
-{
- internal class DTDeserializer : IGraphSONDeserializer
- {
- public dynamic Objectify(JsonElement graphsonObject, GraphSONReader reader)
- {
- return DT.GetByValue(graphsonObject.GetString() ??
- throw new IOException($"Read null but expected a {nameof(DT)} string representation"));
- }
- }
-}
\ No newline at end of file
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/DateDeserializer.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/DateDeserializer.cs
deleted file mode 100644
index b432713701..0000000000
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/DateDeserializer.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-#endregion
-
-using System;
-using System.Text.Json;
-
-namespace Gremlin.Net.Structure.IO.GraphSON
-{
- internal class DateDeserializer : IGraphSONDeserializer
- {
- private static readonly DateTimeOffset UnixStart = new DateTimeOffset(1970, 1, 1, 0, 0, 0, 0, TimeSpan.Zero);
-
- public dynamic Objectify(JsonElement graphsonObject, GraphSONReader reader)
- {
- var milliseconds = graphsonObject.GetInt64();
- return UnixStart.AddTicks(TimeSpan.TicksPerMillisecond * milliseconds);
- }
- }
-}
\ No newline at end of file
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/DecimalConverter.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/DecimalConverter.cs
deleted file mode 100644
index 7736b385c6..0000000000
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/DecimalConverter.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#endregion
-
-using System.Globalization;
-using System.IO;
-using System.Text.Json;
-
-namespace Gremlin.Net.Structure.IO.GraphSON
-{
- internal class DecimalConverter : NumberConverter<decimal>
- {
- protected override string GraphSONTypeName => "BigDecimal";
- protected override string Prefix => "gx";
- protected override bool StringifyValue => true;
- protected override dynamic FromJsonElement(JsonElement graphson)
- {
- if (graphson.ValueKind == JsonValueKind.String)
- {
- return decimal.Parse(
- graphson.GetString() ?? throw new IOException("Read null but expected a decimal string"),
- CultureInfo.InvariantCulture);
- }
- return graphson.GetDecimal();
- }
- }
-}
\ No newline at end of file
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/DirectionDeserializer.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/DirectionDeserializer.cs
deleted file mode 100644
index 056b29993d..0000000000
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/DirectionDeserializer.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#endregion
-
-using System.IO;
-using System.Text.Json;
-using Gremlin.Net.Process.Traversal;
-
-namespace Gremlin.Net.Structure.IO.GraphSON
-{
- internal class DirectionDeserializer : IGraphSONDeserializer
- {
- public dynamic Objectify(JsonElement graphsonObject, GraphSONReader reader)
- {
- return Direction.GetByValue(graphsonObject.GetString() ??
- throw new IOException(
- $"Read null but expected a {nameof(Direction)} string representation"));
- }
- }
-}
\ No newline at end of file
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/DoubleConverter.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/DoubleConverter.cs
deleted file mode 100644
index 476bbc8166..0000000000
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/DoubleConverter.cs
+++ /dev/null
@@ -1,72 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#endregion
-
-using System.Text.Json;
-
-namespace Gremlin.Net.Structure.IO.GraphSON
-{
- internal class DoubleConverter : NumberConverter<double>
- {
- protected override string GraphSONTypeName => "Double";
- private const string NaN = "NaN";
- private const string PositiveInfinity = "Infinity";
- private const string NegativeInfinity = "-Infinity";
-
- protected override dynamic FromJsonElement(JsonElement graphson)
- {
- if (graphson.ValueKind == JsonValueKind.String)
- {
- switch (graphson.GetString())
- {
- case NaN:
- return double.NaN;
- case PositiveInfinity:
- return double.PositiveInfinity;
- case NegativeInfinity:
- return double.NegativeInfinity;
- }
- }
- return graphson.GetDouble();
- }
-
- protected override object ConvertInvalidNumber(double number)
- {
- if (double.IsNaN(number))
- {
- return NaN;
- }
-
- if (double.IsPositiveInfinity(number))
- {
- return PositiveInfinity;
- }
-
- if (double.IsNegativeInfinity(number))
- {
- return NegativeInfinity;
- }
-
- return number;
- }
- }
-}
\ No newline at end of file
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/DurationDeserializer.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/DurationDeserializer.cs
deleted file mode 100644
index 8cc83dbbc5..0000000000
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/DurationDeserializer.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#endregion
-
-using System.IO;
-using System.Text.Json;
-using System.Xml;
-
-namespace Gremlin.Net.Structure.IO.GraphSON
-{
- internal class DurationDeserializer : IGraphSONDeserializer
- {
- public dynamic Objectify(JsonElement graphsonObject, GraphSONReader reader)
- {
- var duration = graphsonObject.GetString();
- return XmlConvert.ToTimeSpan(duration ??
- throw new IOException(
- "Read null but expected a Duration string representation"));
- }
- }
-}
\ No newline at end of file
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/DurationSerializer.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/DurationSerializer.cs
deleted file mode 100644
index fdd549bb0c..0000000000
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/DurationSerializer.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#endregion
-
-using System;
-using System.Collections.Generic;
-using System.Xml;
-
-namespace Gremlin.Net.Structure.IO.GraphSON
-{
- internal class DurationSerializer : IGraphSONSerializer
- {
- public Dictionary<string, dynamic> Dictify(dynamic objectData, GraphSONWriter writer)
- {
- TimeSpan value = objectData;
- return GraphSONUtil.ToTypedValue("Duration", XmlConvert.ToString(value), "gx");
- }
- }
-}
\ No newline at end of file
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/EdgeDeserializer.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/EdgeDeserializer.cs
deleted file mode 100644
index 65dda439d0..0000000000
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/EdgeDeserializer.cs
+++ /dev/null
@@ -1,60 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#endregion
-
-using System;
-using System.Linq;
-using System.Text.Json;
-
-namespace Gremlin.Net.Structure.IO.GraphSON
-{
- internal class EdgeDeserializer : IGraphSONDeserializer
- {
- public dynamic Objectify(JsonElement graphsonObject, GraphSONReader reader)
- {
- var outVId = reader.ToObject(graphsonObject.GetProperty("outV"));
- string outVLabel = graphsonObject.TryGetProperty("outVLabel", out var outVLabelProperty)
- ? outVLabelProperty.GetString()!
- : Vertex.DefaultLabel;
- var outV = new Vertex(outVId, outVLabel);
- var inVId = reader.ToObject(graphsonObject.GetProperty("inV"));
- string inVLabel = graphsonObject.TryGetProperty("inVLabel", out var inVLabelProperty)
- ? inVLabelProperty.GetString()!
- : Vertex.DefaultLabel;
- var inV = new Vertex(inVId, inVLabel);
- var edgeId = reader.ToObject(graphsonObject.GetProperty("id"));
- string edgeLabel = graphsonObject.TryGetProperty("label", out var labelProperty)
- ? labelProperty.GetString()!
- : "edge";
-
- dynamic[] properties = Array.Empty<dynamic>();
- if (graphsonObject.TryGetProperty("properties", out var propertiesObject)
- && propertiesObject.ValueKind == JsonValueKind.Object)
- {
- properties = propertiesObject.EnumerateObject()
- .Select(p => reader.ToObject(p.Value)!).ToArray();
- }
-
- return new Edge(edgeId, outV, edgeLabel, inV, properties);
- }
- }
-}
\ No newline at end of file
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/EdgeSerializer.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/EdgeSerializer.cs
deleted file mode 100644
index c4ff138d1d..0000000000
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/EdgeSerializer.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#endregion
-
-using System.Collections.Generic;
-
-namespace Gremlin.Net.Structure.IO.GraphSON
-{
- internal class EdgeSerializer : IGraphSONSerializer
- {
- public Dictionary<string, dynamic> Dictify(dynamic objectData, GraphSONWriter writer)
- {
- Edge edge = objectData;
- var edgeDict = new Dictionary<string, dynamic>
- {
- {"id", writer.ToDict(edge.Id)},
- {"outV", writer.ToDict(edge.OutV.Id)},
- {"outVLabel", edge.OutV.Label},
- {"label", edge.Label},
- {"inV", writer.ToDict(edge.InV.Id)},
- {"inVLabel", edge.InV.Label}
- };
- return GraphSONUtil.ToTypedValue(nameof(Edge), edgeDict);
- }
- }
-}
\ No newline at end of file
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/EnumSerializer.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/EnumSerializer.cs
deleted file mode 100644
index 2c77aca43c..0000000000
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/EnumSerializer.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#endregion
-
-using System.Collections.Generic;
-using Gremlin.Net.Process.Traversal;
-
-namespace Gremlin.Net.Structure.IO.GraphSON
-{
- internal class EnumSerializer : IGraphSONSerializer
- {
- public Dictionary<string, dynamic> Dictify(dynamic objectData, GraphSONWriter writer)
- {
- EnumWrapper enumToSerialize = objectData;
- return GraphSONUtil.ToTypedValue(enumToSerialize.EnumName, enumToSerialize.EnumValue);
- }
- }
-}
\ No newline at end of file
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/FloatConverter.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/FloatConverter.cs
deleted file mode 100644
index 2c880f033a..0000000000
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/FloatConverter.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#endregion
-
-using System.Text.Json;
-
-namespace Gremlin.Net.Structure.IO.GraphSON
-{
- internal class FloatConverter : NumberConverter<float>
- {
- protected override string GraphSONTypeName => "Float";
- protected override dynamic FromJsonElement(JsonElement graphson) => graphson.GetSingle();
- }
-}
\ No newline at end of file
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GTypeDeserializer.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GTypeDeserializer.cs
deleted file mode 100644
index a4cbaec7cc..0000000000
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GTypeDeserializer.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#endregion
-
-using System.IO;
-using System.Text.Json;
-using Gremlin.Net.Process.Traversal;
-
-namespace Gremlin.Net.Structure.IO.GraphSON
-{
- internal class GTypeDeserializer : IGraphSONDeserializer
- {
- public dynamic Objectify(JsonElement graphsonObject, GraphSONReader reader)
- {
- return GType.GetByValue(graphsonObject.GetString() ??
- throw new IOException($"Read null but expected a {nameof(GType)} string representation"));
- }
- }
-}
\ No newline at end of file
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSON2MessageSerializer.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSON2MessageSerializer.cs
deleted file mode 100644
index 2ed32e5ef9..0000000000
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSON2MessageSerializer.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#endregion
-
-namespace Gremlin.Net.Structure.IO.GraphSON
-{
- /// <summary>
- /// Serializes data to and from Gremlin Server in GraphSON2 format.
- /// </summary>
- public class GraphSON2MessageSerializer : GraphSONMessageSerializer
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="GraphSON2MessageSerializer" /> class with custom serializers.
- /// </summary>
- /// <param name="graphSONReader">The <see cref="GraphSON2Reader"/> used to deserialize from GraphSON.</param>
- /// <param name="graphSONWriter">The <see cref="GraphSON2Writer"/> used to serialize to GraphSON.</param>
- public GraphSON2MessageSerializer(GraphSON2Reader? graphSONReader = null, GraphSON2Writer? graphSONWriter = null)
- : base(SerializationTokens.GraphSON2MimeType, graphSONReader ?? new GraphSON2Reader(), graphSONWriter ?? new GraphSON2Writer())
- {
- }
- }
-}
\ No newline at end of file
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSON2Reader.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSON2Reader.cs
deleted file mode 100644
index f0e46d4a5c..0000000000
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSON2Reader.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#endregion
-
-using System.Collections.Generic;
-
-namespace Gremlin.Net.Structure.IO.GraphSON
-{
- /// <summary>
- /// Handles deserialization of GraphSON3 data.
- /// </summary>
- public class GraphSON2Reader : GraphSONReader
- {
- /// <summary>
- /// Creates a new instance of <see cref="GraphSON2Reader"/>.
- /// </summary>
- public GraphSON2Reader()
- {
-
- }
-
- /// <summary>
- /// Creates a new instance of <see cref="GraphSON2Reader"/>.
- /// </summary>
- public GraphSON2Reader(IReadOnlyDictionary<string, IGraphSONDeserializer> deserializerByGraphSONType) :
- base(deserializerByGraphSONType)
- {
-
- }
- }
-}
\ No newline at end of file
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSON2Writer.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSON2Writer.cs
deleted file mode 100644
index 9440020aa2..0000000000
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSON2Writer.cs
+++ /dev/null
@@ -1,51 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#endregion
-
-using System;
-using System.Collections.Generic;
-
-namespace Gremlin.Net.Structure.IO.GraphSON
-{
- /// <summary>
- /// Handles serialization of GraphSON2 data.
- /// </summary>
- public class GraphSON2Writer : GraphSONWriter
- {
- /// <summary>
- /// Creates a new instance of <see cref="GraphSON2Writer"/>.
- /// </summary>
- public GraphSON2Writer()
- {
-
- }
-
- /// <summary>
- /// Creates a new instance of <see cref="GraphSON2Writer"/>.
- /// </summary>
- public GraphSON2Writer(IReadOnlyDictionary<Type, IGraphSONSerializer> customSerializerByType) :
- base(customSerializerByType)
- {
-
- }
- }
-}
\ No newline at end of file
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSON3MessageSerializer.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSON3MessageSerializer.cs
deleted file mode 100644
index a9cd69c2ec..0000000000
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSON3MessageSerializer.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#endregion
-
-namespace Gremlin.Net.Structure.IO.GraphSON
-{
- /// <summary>
- /// Serializes data to and from Gremlin Server in GraphSON3 format.
- /// </summary>
- public class GraphSON3MessageSerializer : GraphSONMessageSerializer
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="GraphSON3MessageSerializer" /> class with custom serializers.
- /// </summary>
- /// <param name="graphSONReader">The <see cref="GraphSON3Reader"/> used to deserialize from GraphSON.</param>
- /// <param name="graphSONWriter">The <see cref="GraphSON3Writer"/> used to serialize to GraphSON.</param>
- public GraphSON3MessageSerializer(GraphSON3Reader? graphSONReader = null, GraphSON3Writer? graphSONWriter = null)
- : base(SerializationTokens.GraphSON3MimeType, graphSONReader ?? new GraphSON3Reader(), graphSONWriter ?? new GraphSON3Writer())
- {
- }
- }
-}
\ No newline at end of file
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSON3Reader.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSON3Reader.cs
deleted file mode 100644
index 690703f741..0000000000
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSON3Reader.cs
+++ /dev/null
@@ -1,68 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#endregion
-
-using System.Collections.Generic;
-
-namespace Gremlin.Net.Structure.IO.GraphSON
-{
- /// <summary>
- /// Handles deserialization of GraphSON3 data.
- /// </summary>
- public class GraphSON3Reader : GraphSONReader
- {
- private static readonly IDictionary<string, IGraphSONDeserializer> GraphSON3SpecificDeserializers =
- new Dictionary<string, IGraphSONDeserializer>
- {
- { "g:List", new ListSerializer() },
- { "g:Set", new SetSerializer() },
- { "g:Map", new MapSerializer() },
- { "g:BulkSet", new BulkSetSerializer() },
- { "g:Path", new Path3Deserializer() }
- };
-
- /// <summary>
- /// Creates a new instance of <see cref="GraphSON3Reader"/>.
- /// </summary>
- public GraphSON3Reader()
- {
- foreach (var kv in GraphSON3SpecificDeserializers)
- {
- Deserializers[kv.Key] = kv.Value;
- }
- }
-
- /// <summary>
- /// Creates a new instance of <see cref="GraphSON3Reader"/>.
- /// </summary>
- /// <param name="deserializerByGraphSONType">
- /// Overrides <see cref="IGraphSONDeserializer" /> instances by their type identifier.
- /// </param>
- public GraphSON3Reader(IReadOnlyDictionary<string, IGraphSONDeserializer> deserializerByGraphSONType) : this()
- {
- foreach (var deserializerAndGraphSONType in deserializerByGraphSONType)
- {
- Deserializers[deserializerAndGraphSONType.Key] = deserializerAndGraphSONType.Value;
- }
- }
- }
-}
\ No newline at end of file
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSON3Writer.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSON3Writer.cs
deleted file mode 100644
index 5ac75820f6..0000000000
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSON3Writer.cs
+++ /dev/null
@@ -1,68 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#endregion
-
-using System;
-using System.Collections.Generic;
-
-namespace Gremlin.Net.Structure.IO.GraphSON
-{
- /// <summary>
- /// Handles serialization of GraphSON3 data.
- /// </summary>
- public class GraphSON3Writer : GraphSONWriter
- {
- private static readonly IDictionary<Type, IGraphSONSerializer> GraphSON3SpecificSerializers =
- new Dictionary<Type, IGraphSONSerializer>
- {
- { typeof(IList<object>), new ListSerializer() },
- { typeof(ISet<object>), new SetSerializer() },
- { typeof(IDictionary<object, object>), new MapSerializer() }
- };
-
- /// <summary>
- /// Creates a new instance of <see cref="GraphSON3Writer"/>.
- /// </summary>
- public GraphSON3Writer()
- {
- foreach (var kv in GraphSON3SpecificSerializers)
- {
- Serializers[kv.Key] = kv.Value;
- }
- }
-
- /// <summary>
- /// Creates a new instance of <see cref="GraphSON3Writer"/>.
- /// </summary>
- /// <param name="customSerializerByType">
- /// <see cref="IGraphSONSerializer" /> serializers identified by their
- /// <see cref="Type" />.
- /// </param>
- public GraphSON3Writer(IReadOnlyDictionary<Type, IGraphSONSerializer> customSerializerByType) : this()
- {
- foreach (var serializerAndType in customSerializerByType)
- {
- Serializers[serializerAndType.Key] = serializerAndType.Value;
- }
- }
- }
-}
\ No newline at end of file
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONMessageSerializer.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONMessageSerializer.cs
deleted file mode 100644
index 1dc16215ec..0000000000
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONMessageSerializer.cs
+++ /dev/null
@@ -1,88 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#endregion
-
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Text.Json;
-using System.Threading;
-using System.Threading.Tasks;
-using Gremlin.Net.Driver;
-using Gremlin.Net.Driver.Messages;
-
-namespace Gremlin.Net.Structure.IO.GraphSON
-{
- /// <summary>
- /// Serializes data to and from Gremlin Server in GraphSON format.
- /// Retained for backward compatibility; will be removed in Phase 2.
- /// </summary>
- public abstract class GraphSONMessageSerializer : IMessageSerializer
- {
- private readonly string _mimeType;
- private readonly GraphSONReader _graphSONReader;
- private readonly GraphSONWriter _graphSONWriter;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="GraphSONMessageSerializer" /> class.
- /// </summary>
- /// <param name="mimeType">The MIME type supported by this serializer.</param>
- /// <param name="graphSONReader">The <see cref="GraphSONReader"/> used to deserialize from GraphSON.</param>
- /// <param name="graphSonWriter">The <see cref="GraphSONWriter"/> used to serialize to GraphSON.</param>
- protected GraphSONMessageSerializer(string mimeType, GraphSONReader graphSONReader,
- GraphSONWriter graphSonWriter)
- {
- _mimeType = mimeType;
- _graphSONReader = graphSONReader;
- _graphSONWriter = graphSonWriter;
- }
-
- /// <inheritdoc />
- public string MimeType => _mimeType;
-
- /// <inheritdoc />
- public virtual Task<byte[]> SerializeMessageAsync(RequestMessage requestMessage,
- CancellationToken cancellationToken = default)
- {
- if (cancellationToken.CanBeCanceled) cancellationToken.ThrowIfCancellationRequested();
- var graphSONMessage = _graphSONWriter.WriteObject(requestMessage);
- return Task.FromResult(Encoding.UTF8.GetBytes(MessageWithHeader(graphSONMessage)));
- }
-
- private string MessageWithHeader(string messageContent)
- {
- return $"{(char) _mimeType.Length}{_mimeType}{messageContent}";
- }
-
- /// <inheritdoc />
- public virtual Task<ResponseMessage<List<object>>> DeserializeMessageAsync(byte[] message,
- CancellationToken cancellationToken = default)
- {
- if (message == null) throw new ArgumentNullException(nameof(message));
- if (cancellationToken.CanBeCanceled) cancellationToken.ThrowIfCancellationRequested();
-
- // GraphSON deserialization is a legacy path — return empty result
- return Task.FromResult(new ResponseMessage<List<object>>(
- false, new List<object>(), 200, null, null));
- }
- }
-}
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONReader.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONReader.cs
deleted file mode 100644
index 92f2ec0078..0000000000
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONReader.cs
+++ /dev/null
@@ -1,153 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#endregion
-
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Text.Json;
-
-namespace Gremlin.Net.Structure.IO.GraphSON
-{
- /// <summary>
- /// Allows to deserialize GraphSON to objects.
- /// </summary>
- public abstract class GraphSONReader
- {
- /// <summary>
- /// Contains the <see cref="IGraphSONDeserializer" /> instances by their type identifier.
- /// </summary>
- protected readonly Dictionary<string, IGraphSONDeserializer> Deserializers = new()
- {
- { "g:Traverser", new TraverserReader() },
- { "g:Int32", new Int32Converter() },
- { "g:Int64", new Int64Converter() },
- { "g:Float", new FloatConverter() },
- { "g:Double", new DoubleConverter() },
- { "g:Direction", new DirectionDeserializer() },
- { "g:DT", new DTDeserializer() },
- { "g:GType", new GTypeDeserializer() },
- { "g:Merge", new MergeDeserializer() },
- { "g:UUID", new UuidDeserializer() },
- { "g:Date", new DateDeserializer() },
- { "g:Timestamp", new DateDeserializer() },
- { "g:Vertex", new VertexDeserializer() },
- { "g:Edge", new EdgeDeserializer() },
- { "g:Property", new PropertyDeserializer() },
- { "g:VertexProperty", new VertexPropertyDeserializer() },
- { "g:Path", new PathDeserializer() },
- { "g:T", new TDeserializer() },
-
- //Extended
- { "gx:OffsetDateTime", new OffsetDateTimeDeserializer() },
- { "gx:BigDecimal", new DecimalConverter() },
- { "gx:Duration", new DurationDeserializer() },
- { "gx:BigInteger", new BigIntegerDeserializer() },
- { "gx:Byte", new SByteConverter() },
- { "gx:ByteBuffer", new ByteBufferDeserializer() },
- { "gx:Char", new CharConverter() },
- { "gx:Int16", new Int16Converter() }
- };
-
- /// <summary>
- /// Initializes a new instance of the <see cref="GraphSONReader" /> class.
- /// </summary>
- protected GraphSONReader()
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="GraphSONReader" /> class.
- /// </summary>
- /// <param name="deserializerByGraphSONType">
- /// <see cref="IGraphSONDeserializer" /> deserializers identified by their
- /// GraphSON type.
- /// </param>
- protected GraphSONReader(IReadOnlyDictionary<string, IGraphSONDeserializer> deserializerByGraphSONType)
- {
- foreach (var deserializerAndGraphSONType in deserializerByGraphSONType)
- Deserializers[deserializerAndGraphSONType.Key] = deserializerAndGraphSONType.Value;
- }
-
- /// <summary>
- /// Deserializes a GraphSON collection to an object.
- /// </summary>
- /// <param name="graphSonData">The GraphSON collection to deserialize.</param>
- /// <returns>The deserialized object.</returns>
- public virtual dynamic ToObject(IEnumerable<JsonElement> graphSonData)
- {
- return graphSonData.Select(graphson => ToObject(graphson));
- }
-
- /// <summary>
- /// Deserializes GraphSON to an object.
- /// </summary>
- /// <param name="graphSon">The GraphSON to deserialize.</param>
- /// <returns>The deserialized object.</returns>
- public virtual dynamic? ToObject(JsonElement graphSon)
- {
- switch (graphSon.ValueKind)
- {
- case JsonValueKind.Array:
- return graphSon.EnumerateArray().Select(t => ToObject(t));
- case JsonValueKind.String:
- return graphSon.GetString();
- case JsonValueKind.Null:
- return null;
- case JsonValueKind.True:
- return true;
- case JsonValueKind.False:
- return false;
- case JsonValueKind.Object:
- break;
- default:
- throw new ArgumentOutOfRangeException(nameof(graphSon.ValueKind), graphSon.ValueKind,
- $"JSON type not supported.");
- }
-
- if (graphSon.TryGetProperty(GraphSONTokens.TypeKey, out var graphSonTypeProperty))
- {
- return ReadValueOfType(graphSon,
- graphSonTypeProperty.GetString() ??
- throw new IOException("Read GraphSON type key is not a string"));
- }
- return ReadDictionary(graphSon);
-
- }
-
- private dynamic ReadValueOfType(JsonElement typedValue, string graphSONType)
- {
- if (!Deserializers.TryGetValue(graphSONType, out var deserializer))
- {
- throw new InvalidOperationException($"Deserializer for \"{graphSONType}\" not found");
- }
- return deserializer.Objectify(typedValue.GetProperty(GraphSONTokens.ValueKey), this);
- }
-
- private dynamic ReadDictionary(JsonElement jsonDict)
- {
- return jsonDict.EnumerateObject()
- .ToDictionary(property => property.Name, property => ToObject(property.Value));
- }
- }
-}
\ No newline at end of file
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONTokens.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONTokens.cs
deleted file mode 100644
index 690eaff5bd..0000000000
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONTokens.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#endregion
-
-namespace Gremlin.Net.Structure.IO.GraphSON
-{
- internal class GraphSONTokens
- {
- public static string TypeKey = "@type";
- public static string ValueKey = "@value";
- public static string GremlinTypeNamespace = "g";
- }
-}
\ No newline at end of file
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONUtil.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONUtil.cs
deleted file mode 100644
index 9e7d4b3ed8..0000000000
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONUtil.cs
+++ /dev/null
@@ -1,83 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#endregion
-
-using System;
-using System.Collections;
-using System.Collections.Generic;
-
-namespace Gremlin.Net.Structure.IO.GraphSON
-{
- /// <summary>
- /// Provides helper methods for GraphSON serialization.
- /// </summary>
- public static class GraphSONUtil
- {
- /// <summary>
- /// Transforms a value intos its GraphSON representation including type information.
- /// </summary>
- /// <param name="typename">The name of the type.</param>
- /// <param name="value">The value to transform.</param>
- /// <param name="prefix">A namespace prefix for the typename.</param>
- /// <returns>The GraphSON representation including type information.</returns>
- public static Dictionary<string, dynamic> ToTypedValue(string typename, dynamic value, string prefix = "g")
- {
- var typedValue = new Dictionary<string, dynamic>
- {
- {GraphSONTokens.TypeKey, FormatTypeName(prefix, typename)}
- };
- if (value != null)
- typedValue[GraphSONTokens.ValueKey] = value;
- return typedValue;
- }
-
- /// <summary>
- /// Formats a type name with its prefix to a GraphSON TypeID.
- /// </summary>
- /// <param name="namespacePrefix">The namespace prefix (default is "g").</param>
- /// <param name="typeName">The name of the type.</param>
- /// <returns>The formatted TypeID.</returns>
- public static string FormatTypeName(string namespacePrefix, string typeName)
- {
- return $"{namespacePrefix}:{typeName}";
- }
-
- /// <summary>
- /// Converts a Collection to a representation of g:List or g:Set
- /// </summary>
- internal static Dictionary<string, dynamic> ToCollection(dynamic objectData, GraphSONWriter writer,
- string typename)
- {
- var collection = objectData as IEnumerable;
- if (collection == null)
- {
- throw new InvalidOperationException("Object must implement IEnumerable");
- }
- var result = new List<object>();
- foreach (var item in collection)
- {
- result.Add(writer.ToDict(item));
- }
- return ToTypedValue(typename, result);
- }
- }
-}
\ No newline at end of file
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONWriter.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONWriter.cs
deleted file mode 100644
index 60fe3dcf36..0000000000
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONWriter.cs
+++ /dev/null
@@ -1,177 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#endregion
-
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Diagnostics.CodeAnalysis;
-using System.Linq;
-using System.Numerics;
-using System.Text.Encodings.Web;
-using System.Text.Json;
-using Gremlin.Net.Driver.Messages;
-using Gremlin.Net.Process.Traversal;
-using Gremlin.Net.Process.Traversal.Strategy;
-
-namespace Gremlin.Net.Structure.IO.GraphSON
-{
- /// <summary>
- /// Allows to serialize objects to GraphSON.
- /// </summary>
- public abstract class GraphSONWriter
- {
- private static readonly JsonSerializerOptions JsonOptions = new()
- { Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping };
-
- /// <summary>
- /// Contains the information of serializers by type.
- /// </summary>
- protected readonly Dictionary<Type, IGraphSONSerializer> Serializers = new()
- {
- { typeof(ITraversal), new TraversalSerializer() },
- { typeof(RequestMessage), new RequestMessageSerializer() },
- { typeof(int), new Int32Converter() },
- { typeof(long), new Int64Converter() },
- { typeof(float), new FloatConverter() },
- { typeof(double), new DoubleConverter() },
- { typeof(Guid), new UuidSerializer() },
- { typeof(Type), new ClassSerializer() },
- { typeof(EnumWrapper), new EnumSerializer() },
- { typeof(P), new PSerializer() },
- { typeof(TextP), new TextPSerializer() },
- { typeof(Vertex), new VertexSerializer() },
- { typeof(Edge), new EdgeSerializer() },
- { typeof(Property), new PropertySerializer() },
- { typeof(VertexProperty), new VertexPropertySerializer() },
- { typeof(AbstractTraversalStrategy), new TraversalStrategySerializer() },
- { typeof(ILambda), new LambdaSerializer() },
-
- //Extended
- { typeof(DateTimeOffset), new OffsetDateTimeSerializer() }, // DateTimeOffset will be serialized as OffsetDateTimeSerializer by default
- { typeof(decimal), new DecimalConverter() },
- { typeof(TimeSpan), new DurationSerializer() },
- { typeof(BigInteger), new BigIntegerSerializer() },
- { typeof(sbyte), new SByteConverter() },
- { typeof(byte[]), new ByteBufferSerializer() },
- { typeof(char), new CharConverter() },
- { typeof(short), new Int16Converter() }
- };
-
- /// <summary>
- /// Initializes a new instance of the <see cref="GraphSONWriter" /> class.
- /// </summary>
- protected GraphSONWriter()
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="GraphSONWriter" /> class.
- /// </summary>
- /// <param name="customSerializerByType">
- /// <see cref="IGraphSONSerializer" /> serializers identified by their
- /// <see cref="Type" />.
- /// </param>
- protected GraphSONWriter(IReadOnlyDictionary<Type, IGraphSONSerializer> customSerializerByType)
- {
- foreach (var serializerAndType in customSerializerByType)
- Serializers[serializerAndType.Key] = serializerAndType.Value;
- }
-
- /// <summary>
- /// Serializes an object to GraphSON.
- /// </summary>
- /// <param name="objectData">The object to serialize.</param>
- /// <returns>The serialized GraphSON.</returns>
- public virtual string WriteObject(dynamic objectData)
- {
- return JsonSerializer.Serialize(ToDict(objectData), JsonOptions);
- }
-
- /// <summary>
- /// Transforms an object into its GraphSON representation including type information.
- /// </summary>
- /// <param name="objectData">The object to transform.</param>
- /// <returns>A GraphSON representation of the object ready to be serialized.</returns>
- [return: NotNullIfNotNull("objectData")]
- public dynamic? ToDict(dynamic? objectData)
- {
- if (objectData != null)
- {
- var type = objectData.GetType();
-
- IGraphSONSerializer serializer = TryGetSerializerFor(type);
-
- if (serializer != null)
- return serializer.Dictify(objectData, this);
- if (IsDictionaryType(type))
- return DictToGraphSONDict(objectData);
- if (IsCollectionType(type))
- return CollectionToGraphSONCollection(objectData);
- }
- return objectData;
- }
-
- private IGraphSONSerializer? TryGetSerializerFor(Type type)
- {
- if (Serializers.TryGetValue(type, out var serializer))
- {
- return serializer;
- }
- foreach (var supportedType in new List<Type>(Serializers.Keys))
- if (supportedType.IsAssignableFrom(type))
- {
- return Serializers[supportedType];
- }
- return null;
- }
-
- private bool IsDictionaryType(Type type)
- {
- return type
- .GetInterfaces()
- .Any(interfaceType => interfaceType.IsConstructedGenericType
- && interfaceType.GetGenericTypeDefinition() == typeof(IEnumerable<>)
- && interfaceType.GenericTypeArguments[0] is { IsConstructedGenericType: true } genericArgument
- && genericArgument.GetGenericTypeDefinition() == typeof(KeyValuePair<,>));
- }
-
- private Dictionary<string, dynamic> DictToGraphSONDict(dynamic dict)
- {
- var graphSONDict = new Dictionary<string, dynamic>();
- foreach (var keyValue in dict)
- graphSONDict.Add(ToDict(keyValue.Key), ToDict(keyValue.Value));
- return graphSONDict;
- }
-
- private bool IsCollectionType(Type type)
- {
- return type.GetInterfaces().Contains(typeof(ICollection));
- }
-
- private IEnumerable<dynamic> CollectionToGraphSONCollection(dynamic collection)
- {
- foreach (var e in collection)
- yield return ToDict(e);
- }
- }
-}
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/IGraphSONDeserializer.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/IGraphSONDeserializer.cs
deleted file mode 100644
index deeea5c86f..0000000000
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/IGraphSONDeserializer.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#endregion
-
-using System.Text.Json;
-
-namespace Gremlin.Net.Structure.IO.GraphSON
-{
- /// <summary>
- /// Supports deserializing GraphSON into an object.
- /// </summary>
- public interface IGraphSONDeserializer
- {
- /// <summary>
- /// Deserializes GraphSON to an object.
- /// </summary>
- /// <param name="graphsonObject">The GraphSON object to objectify.</param>
- /// <param name="reader">A <see cref="GraphSONReader" /> that can be used to objectify properties of the GraphSON object.</param>
- /// <returns>The deserialized object.</returns>
- dynamic Objectify(JsonElement graphsonObject, GraphSONReader reader);
- }
-}
\ No newline at end of file
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/IGraphSONSerializer.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/IGraphSONSerializer.cs
deleted file mode 100644
index 58befc3ce9..0000000000
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/IGraphSONSerializer.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#endregion
-
-using System.Collections.Generic;
-
-namespace Gremlin.Net.Structure.IO.GraphSON
-{
- /// <summary>
- /// Supports serializing of an object to GraphSON.
- /// </summary>
- public interface IGraphSONSerializer
- {
- /// <summary>
- /// Transforms an object into a dictionary that resembles its GraphSON representation.
- /// </summary>
- /// <param name="objectData">The object to dictify.</param>
- /// <param name="writer">A <see cref="GraphSONWriter" /> that can be used to dictify properties of the object.</param>
- /// <returns>The GraphSON representation.</returns>
- Dictionary<string, dynamic> Dictify(dynamic objectData, GraphSONWriter writer);
- }
-}
\ No newline at end of file
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/Int16Converter.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/Int16Converter.cs
deleted file mode 100644
index 51aa40f0bc..0000000000
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/Int16Converter.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#endregion
-
-using System.Text.Json;
-
-namespace Gremlin.Net.Structure.IO.GraphSON
-{
- internal class Int16Converter : NumberConverter<short>
- {
- protected override string GraphSONTypeName => "Int16";
- protected override string Prefix => "gx";
-
- protected override dynamic FromJsonElement(JsonElement graphson) => graphson.GetInt16();
- }
-}
\ No newline at end of file
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/Int32Converter.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/Int32Converter.cs
deleted file mode 100644
index aebffa31dc..0000000000
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/Int32Converter.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#endregion
-
-using System.Text.Json;
-
-namespace Gremlin.Net.Structure.IO.GraphSON
-{
- internal class Int32Converter : NumberConverter<int>
- {
- protected override string GraphSONTypeName => "Int32";
-
- protected override dynamic FromJsonElement(JsonElement graphson) => graphson.GetInt32();
- }
-}
\ No newline at end of file
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/Int64Converter.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/Int64Converter.cs
deleted file mode 100644
index 6c328b4f6b..0000000000
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/Int64Converter.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#endregion
-
-using System.Text.Json;
-
-namespace Gremlin.Net.Structure.IO.GraphSON
-{
- internal class Int64Converter : NumberConverter<long>
- {
- protected override string GraphSONTypeName => "Int64";
-
- protected override dynamic FromJsonElement(JsonElement graphson) => graphson.GetInt64();
- }
-}
\ No newline at end of file
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/LambdaSerializer.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/LambdaSerializer.cs
deleted file mode 100644
index d965267b0f..0000000000
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/LambdaSerializer.cs
+++ /dev/null
@@ -1,43 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#endregion
-
-using System.Collections.Generic;
-using Gremlin.Net.Process.Traversal;
-
-namespace Gremlin.Net.Structure.IO.GraphSON
-{
- internal class LambdaSerializer : IGraphSONSerializer
- {
- public Dictionary<string, dynamic> Dictify(dynamic objectData, GraphSONWriter writer)
- {
- ILambda lambda = objectData;
- var valueDict = new Dictionary<string, dynamic>
- {
- {"script", lambda.LambdaExpression},
- {"language", lambda.Language},
- {"arguments", lambda.Arguments}
- };
- return GraphSONUtil.ToTypedValue(nameof(Lambda), valueDict);
- }
- }
-}
\ No newline at end of file
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/ListSerializer.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/ListSerializer.cs
deleted file mode 100644
index 6aa685e9ec..0000000000
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/ListSerializer.cs
+++ /dev/null
@@ -1,54 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#endregion
-
-using System;
-using System.Collections.Generic;
-using System.Text.Json;
-
-namespace Gremlin.Net.Structure.IO.GraphSON
-{
- internal class ListSerializer : IGraphSONDeserializer, IGraphSONSerializer
- {
- private static readonly IReadOnlyList<object> EmptyList = Array.Empty<object>();
-
- public dynamic Objectify(JsonElement graphsonObject, GraphSONReader reader)
- {
- if (graphsonObject.ValueKind != JsonValueKind.Array)
- {
- return EmptyList;
- }
- var result = new object?[graphsonObject.GetArrayLength()];
- for (var i = 0; i < result.Length; i++)
- {
- result[i] = reader.ToObject(graphsonObject[i]);
- }
- // object[] implements IList<object>
- return result;
- }
-
- public Dictionary<string, dynamic> Dictify(dynamic objectData, GraphSONWriter writer)
- {
- return GraphSONUtil.ToCollection(objectData, writer, "List");
- }
- }
-}
\ No newline at end of file
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/MapSerializer.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/MapSerializer.cs
deleted file mode 100644
index 67249caba2..0000000000
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/MapSerializer.cs
+++ /dev/null
@@ -1,64 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#endregion
-
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Text.Json;
-
-namespace Gremlin.Net.Structure.IO.GraphSON
-{
- internal class MapSerializer : IGraphSONDeserializer, IGraphSONSerializer
- {
- public dynamic Objectify(JsonElement graphsonObject, GraphSONReader reader)
- {
- if (graphsonObject.ValueKind != JsonValueKind.Array)
- {
- return new Dictionary<object, object>(0);
- }
- var result = new Dictionary<object, object?>(graphsonObject.GetArrayLength() / 2);
- for (var i = 0; i < graphsonObject.GetArrayLength(); i += 2)
- {
- result[reader.ToObject(graphsonObject[i])] = reader.ToObject(graphsonObject[i + 1]);
- }
- // IDictionary<object, object>
- return result;
- }
-
- public Dictionary<string, dynamic> Dictify(dynamic objectData, GraphSONWriter writer)
- {
- if (!(objectData is IDictionary map))
- {
- throw new InvalidOperationException("Object must implement IDictionary");
- }
- var result = new object?[map.Count * 2];
- var index = 0;
- foreach (var key in map.Keys)
- {
- result[index++] = writer.ToDict(key);
- result[index++] = writer.ToDict(map[key]);
- }
- return GraphSONUtil.ToTypedValue("Map", result);
- }
- }
-}
\ No newline at end of file
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/MergeDeserializer.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/MergeDeserializer.cs
deleted file mode 100644
index b1ff05210d..0000000000
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/MergeDeserializer.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#endregion
-
-using System.IO;
-using System.Text.Json;
-using Gremlin.Net.Process.Traversal;
-
-namespace Gremlin.Net.Structure.IO.GraphSON
-{
- internal class MergeDeserializer : IGraphSONDeserializer
- {
- public dynamic Objectify(JsonElement graphsonObject, GraphSONReader reader)
- {
- return Merge.GetByValue(graphsonObject.GetString() ??
- throw new IOException("Read null but expected a Merge value"));
- }
- }
-}
\ No newline at end of file
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/NumberConverter.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/NumberConverter.cs
deleted file mode 100644
index 110a22fe36..0000000000
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/NumberConverter.cs
+++ /dev/null
@@ -1,56 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#endregion
-
-using System.Collections.Generic;
-using System.Globalization;
-using System.Text.Json;
-
-namespace Gremlin.Net.Structure.IO.GraphSON
-{
- internal abstract class NumberConverter<T> : IGraphSONDeserializer, IGraphSONSerializer where T : notnull
- {
- protected abstract string GraphSONTypeName { get; }
- protected virtual string Prefix => "g";
- protected virtual bool StringifyValue => false;
-
- public dynamic Objectify(JsonElement graphsonObject, GraphSONReader reader)
- {
- return FromJsonElement(graphsonObject);
- }
-
- protected abstract dynamic FromJsonElement(JsonElement graphson);
-
- public Dictionary<string, dynamic> Dictify(dynamic objectData, GraphSONWriter writer)
- {
- T number = objectData;
- var value = ConvertInvalidNumber(number);
- if (StringifyValue)
- {
- value = string.Format(CultureInfo.InvariantCulture, "{0}", value);
- }
- return GraphSONUtil.ToTypedValue(GraphSONTypeName, value, Prefix);
- }
-
- protected virtual object ConvertInvalidNumber(T number) => number;
- }
-}
\ No newline at end of file
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/OffsetDateTimeDeserializer.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/OffsetDateTimeDeserializer.cs
deleted file mode 100644
index bae59399a2..0000000000
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/OffsetDateTimeDeserializer.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-#endregion
-
-using System;
-using System.IO;
-using System.Text.Json;
-
-namespace Gremlin.Net.Structure.IO.GraphSON
-{
- internal class OffsetDateTimeDeserializer : IGraphSONDeserializer
- {
- public dynamic Objectify(JsonElement graphsonObject, GraphSONReader reader)
- {
- return DateTimeOffset.Parse(graphsonObject.GetString() ??
- throw new IOException("Read null but expected a OffsetDateTime value"));
- }
- }
-}
\ No newline at end of file
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/OffsetDateTimeSerializer.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/OffsetDateTimeSerializer.cs
deleted file mode 100644
index 9c9f94627f..0000000000
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/OffsetDateTimeSerializer.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#endregion
-
-using System;
-using System.Collections.Generic;
-
-namespace Gremlin.Net.Structure.IO.GraphSON
-{
- internal class OffsetDateTimeSerializer : IGraphSONSerializer
- {
- public Dictionary<string, dynamic> Dictify(dynamic objectData, GraphSONWriter writer)
- {
- DateTimeOffset value = objectData;
- return GraphSONUtil.ToTypedValue("OffsetDateTime", value.ToString("O"), "gx");
- }
- }
-}
\ No newline at end of file
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/PSerializer.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/PSerializer.cs
deleted file mode 100644
index ae35540a92..0000000000
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/PSerializer.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#endregion
-
-using System.Collections.Generic;
-using Gremlin.Net.Process.Traversal;
-
-namespace Gremlin.Net.Structure.IO.GraphSON
-{
- internal class PSerializer : IGraphSONSerializer
- {
- public Dictionary<string, dynamic> Dictify(dynamic predicate, GraphSONWriter writer)
- {
- P p = predicate;
- var value = p.Other == null
- ? writer.ToDict(p.Value)
- : new List<dynamic> {writer.ToDict(p.Value), writer.ToDict(p.Other)};
- var dict = new Dictionary<string, dynamic>
- {
- {"predicate", p.OperatorName},
- {"value", value}
- };
- return GraphSONUtil.ToTypedValue("P", dict);
- }
- }
-}
\ No newline at end of file
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/Path3Deserializer.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/Path3Deserializer.cs
deleted file mode 100644
index 991bab87a7..0000000000
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/Path3Deserializer.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#endregion
-
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Text.Json;
-
-namespace Gremlin.Net.Structure.IO.GraphSON
-{
- internal class Path3Deserializer : IGraphSONDeserializer
- {
- public dynamic Objectify(JsonElement graphsonObject, GraphSONReader reader)
- {
- // "labels" is a object[] where each item is ISet<object>
- var labelProperty = (object[]?)reader.ToObject(graphsonObject.GetProperty("labels"));
- if (labelProperty == null) throw new IOException($"Could not read the labels for the {nameof(Path)}");
- var labels = labelProperty
- .Select(x => new HashSet<string>(((ISet<object>)x).Cast<string>()))
- .ToList<ISet<string>>();
- // "objects" is an object[]
- object?[] objects = reader.ToObject(graphsonObject.GetProperty("objects")) ??
- throw new IOException($"Could not read the objects for the {nameof(Path)}");
- return new Path(labels, objects);
- }
- }
-}
\ No newline at end of file
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/PathDeserializer.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/PathDeserializer.cs
deleted file mode 100644
index d8c2b8a0a8..0000000000
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/PathDeserializer.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#endregion
-
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Text.Json;
-
-namespace Gremlin.Net.Structure.IO.GraphSON
-{
- internal class PathDeserializer : IGraphSONDeserializer
- {
- public dynamic Objectify(JsonElement graphsonObject, GraphSONReader reader)
- {
- var labels =
- graphsonObject.GetProperty("labels").EnumerateArray()
- .Select(readObjLabels =>
- new HashSet<string>(readObjLabels.EnumerateArray().Select(l =>
- l.GetString() ?? throw new IOException("Read null but expected a Path label"))))
- .ToList<ISet<string>>();
- var objects = graphsonObject.GetProperty("objects").EnumerateArray().Select(o => reader.ToObject(o))
- .ToList();
- return new Path(labels, objects);
- }
- }
-}
\ No newline at end of file
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/PropertyDeserializer.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/PropertyDeserializer.cs
deleted file mode 100644
index c9654626c7..0000000000
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/PropertyDeserializer.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#endregion
-
-using System.Text.Json;
-
-namespace Gremlin.Net.Structure.IO.GraphSON
-{
- internal class PropertyDeserializer : IGraphSONDeserializer
- {
- public dynamic Objectify(JsonElement graphsonObject, GraphSONReader reader)
- {
- string key = graphsonObject.GetProperty("key").GetString()!;
- var value = reader.ToObject(graphsonObject.GetProperty("value"));
- var element = graphsonObject.TryGetProperty("element", out var elementProperty)
- ? reader.ToObject(elementProperty)
- : null;
- return new Property(key, value, element);
- }
- }
-}
\ No newline at end of file
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/PropertySerializer.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/PropertySerializer.cs
deleted file mode 100644
index 8717be84e1..0000000000
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/PropertySerializer.cs
+++ /dev/null
@@ -1,67 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#endregion
-
-using System.Collections.Generic;
-using System.IO;
-
-namespace Gremlin.Net.Structure.IO.GraphSON
-{
- internal class PropertySerializer : IGraphSONSerializer
- {
- public Dictionary<string, dynamic> Dictify(dynamic objectData, GraphSONWriter writer)
- {
- Property property = objectData;
- var elementDict = CreateElementDict(property.Element, writer);
- var valueDict = new Dictionary<string, dynamic>
- {
- {"key", property.Key},
- {"value", writer.ToDict(property.Value)},
- {"element", elementDict}
- };
- return GraphSONUtil.ToTypedValue(nameof(Property), valueDict);
- }
-
- private dynamic? CreateElementDict(Element? element, GraphSONWriter writer)
- {
- if (element == null)
- return null;
- var serializedElement = writer.ToDict(element);
- if (serializedElement == null)
- {
- throw new IOException(
- $"Could not write the {nameof(Property.Element)} of this {nameof(Property)}, {nameof(Property.Element)}: {element}");
- }
- Dictionary<string, dynamic> elementDict = serializedElement;
- if (elementDict.ContainsKey(GraphSONTokens.ValueKey))
- {
- var elementValueSerialized = elementDict[GraphSONTokens.ValueKey];
- Dictionary<string, dynamic> elementValueDict = elementValueSerialized;
- elementValueDict.Remove("outVLabel");
- elementValueDict.Remove("inVLabel");
- elementValueDict.Remove("properties");
- elementValueDict.Remove("value");
- }
- return serializedElement;
- }
- }
-}
\ No newline at end of file
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/RequestMessageSerializer.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/RequestMessageSerializer.cs
deleted file mode 100644
index 47fe602189..0000000000
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/RequestMessageSerializer.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#endregion
-
-using System.Collections.Generic;
-using Gremlin.Net.Driver.Messages;
-
-namespace Gremlin.Net.Structure.IO.GraphSON
-{
- internal class RequestMessageSerializer : IGraphSONSerializer
- {
- public Dictionary<string, dynamic> Dictify(dynamic objectData, GraphSONWriter writer)
- {
- RequestMessage msg = objectData;
- return new Dictionary<string, dynamic>
- {
- {"gremlin", msg.Gremlin},
- {"fields", writer.ToDict(msg.Fields)}
- };
- }
- }
-}
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/SByteConverter.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/SByteConverter.cs
deleted file mode 100644
index 8537228277..0000000000
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/SByteConverter.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-#endregion
-
-using System.Text.Json;
-
-namespace Gremlin.Net.Structure.IO.GraphSON
-{
- internal class SByteConverter : NumberConverter<sbyte>
- {
- protected override string GraphSONTypeName => "Byte";
- protected override string Prefix => "gx";
- protected override dynamic FromJsonElement(JsonElement graphson) => graphson.GetSByte();
- }
-}
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/SetSerializer.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/SetSerializer.cs
deleted file mode 100644
index b2cdaad754..0000000000
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/SetSerializer.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#endregion
-
-using System.Collections.Generic;
-using System.Linq;
-using System.Text.Json;
-
-namespace Gremlin.Net.Structure.IO.GraphSON
-{
- internal class SetSerializer : IGraphSONDeserializer, IGraphSONSerializer
- {
- public dynamic Objectify(JsonElement graphsonObject, GraphSONReader reader)
- {
- if (graphsonObject.ValueKind != JsonValueKind.Array)
- {
- return new HashSet<object>();
- }
- // ISet<object>
- return new HashSet<object?>(graphsonObject.EnumerateArray().Select(reader.ToObject));
- }
-
- public Dictionary<string, dynamic> Dictify(dynamic objectData, GraphSONWriter writer)
- {
- return GraphSONUtil.ToCollection(objectData, writer, "Set");
- }
- }
-}
\ No newline at end of file
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/TDeserializer.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/TDeserializer.cs
deleted file mode 100644
index b002e0ce26..0000000000
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/TDeserializer.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#endregion
-
-using System.IO;
-using System.Text.Json;
-using Gremlin.Net.Process.Traversal;
-
-namespace Gremlin.Net.Structure.IO.GraphSON
-{
- internal class TDeserializer : IGraphSONDeserializer
- {
- public dynamic Objectify(JsonElement graphsonObject, GraphSONReader reader)
- {
- return T.GetByValue(graphsonObject.GetString()??
- throw new IOException($"Read null but expected a {nameof(T)} string representation"));
- }
- }
-}
\ No newline at end of file
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/TextPSerializer.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/TextPSerializer.cs
deleted file mode 100644
index 0c02f584f1..0000000000
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/TextPSerializer.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#endregion
-
-using System.Collections.Generic;
-using Gremlin.Net.Process.Traversal;
-
-namespace Gremlin.Net.Structure.IO.GraphSON
-{
- internal class TextPSerializer : IGraphSONSerializer
- {
- public Dictionary<string, dynamic> Dictify(dynamic predicate, GraphSONWriter writer)
- {
- TextP p = predicate;
- var value = p.Other == null
- ? writer.ToDict(p.Value)
- : new List<dynamic> {writer.ToDict(p.Value), writer.ToDict(p.Other)};
- var dict = new Dictionary<string, dynamic>
- {
- {"predicate", p.OperatorName},
- {"value", value}
- };
- return GraphSONUtil.ToTypedValue("TextP", dict);
- }
- }
-}
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/TraversalSerializer.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/TraversalSerializer.cs
deleted file mode 100644
index 6f7b9be79f..0000000000
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/TraversalSerializer.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#endregion
-
-using System;
-using System.Collections.Generic;
-using Gremlin.Net.Process.Traversal;
-
-namespace Gremlin.Net.Structure.IO.GraphSON
-{
- internal class TraversalSerializer : IGraphSONSerializer
- {
- public Dictionary<string, dynamic> Dictify(dynamic objectData, GraphSONWriter writer)
- {
- throw new NotSupportedException("Traversal serialization via GraphSON is no longer supported. Use GremlinLang instead.");
- }
- }
-}
\ No newline at end of file
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/TraversalStrategySerializer.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/TraversalStrategySerializer.cs
deleted file mode 100644
index 03e66ac794..0000000000
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/TraversalStrategySerializer.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#endregion
-
-using System.Collections.Generic;
-using Gremlin.Net.Process.Traversal.Strategy;
-
-namespace Gremlin.Net.Structure.IO.GraphSON
-{
- internal class TraversalStrategySerializer : IGraphSONSerializer
- {
- public Dictionary<string, dynamic> Dictify(dynamic objectData, GraphSONWriter writer)
- {
- AbstractTraversalStrategy strategy = objectData;
- var stratData = new Dictionary<string, dynamic>
- {
- {"fqcn", strategy.Fqcn},
- {"conf", writer.ToDict(strategy.Configuration)},
- };
- return GraphSONUtil.ToTypedValue(strategy.StrategyName, stratData);
- }
- }
-}
\ No newline at end of file
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/TraverserReader.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/TraverserReader.cs
deleted file mode 100644
index 691280d23b..0000000000
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/TraverserReader.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#endregion
-
-using System.Text.Json;
-using Gremlin.Net.Process.Traversal;
-
-namespace Gremlin.Net.Structure.IO.GraphSON
-{
- internal class TraverserReader : IGraphSONDeserializer
- {
- public dynamic Objectify(JsonElement graphsonObject, GraphSONReader reader)
- {
- var bulkObj = reader.ToObject(graphsonObject.GetProperty("bulk"));
- var valueObj = reader.ToObject(graphsonObject.GetProperty("value"));
- return new Traverser(valueObj, bulkObj);
- }
- }
-}
\ No newline at end of file
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/UuidDeserializer.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/UuidDeserializer.cs
deleted file mode 100644
index bb9b07c8d0..0000000000
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/UuidDeserializer.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#endregion
-
-using System;
-using System.IO;
-using System.Text.Json;
-
-namespace Gremlin.Net.Structure.IO.GraphSON
-{
- internal class UuidDeserializer : IGraphSONDeserializer
- {
- public dynamic Objectify(JsonElement graphsonObject, GraphSONReader reader)
- {
- var uuidString = graphsonObject.GetString();
- if (uuidString == null) throw new IOException("Read null but expected a GUID string representation");
- return Guid.Parse(uuidString);
- }
- }
-}
\ No newline at end of file
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/UuidSerializer.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/UuidSerializer.cs
deleted file mode 100644
index 1f355dfd0e..0000000000
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/UuidSerializer.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#endregion
-
-using System;
-using System.Collections.Generic;
-
-namespace Gremlin.Net.Structure.IO.GraphSON
-{
- internal class UuidSerializer : IGraphSONSerializer
- {
- public Dictionary<string, dynamic> Dictify(dynamic objectData, GraphSONWriter writer)
- {
- Guid guid = objectData;
- return GraphSONUtil.ToTypedValue("UUID", guid);
- }
- }
-}
\ No newline at end of file
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/VertexDeserializer.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/VertexDeserializer.cs
deleted file mode 100644
index 1e887f6ed0..0000000000
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/VertexDeserializer.cs
+++ /dev/null
@@ -1,51 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#endregion
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text.Json;
-
-namespace Gremlin.Net.Structure.IO.GraphSON
-{
- internal class VertexDeserializer : IGraphSONDeserializer
- {
- public dynamic Objectify(JsonElement graphsonObject, GraphSONReader reader)
- {
- var id = reader.ToObject(graphsonObject.GetProperty("id"));
- string label = graphsonObject.TryGetProperty("label", out var labelProperty)
- ? labelProperty.GetString()!
- : Vertex.DefaultLabel;
-
- dynamic[] properties = Array.Empty<dynamic>();
- if (graphsonObject.TryGetProperty("properties", out var propertiesObject)
- && propertiesObject.ValueKind == JsonValueKind.Object)
- {
- properties = propertiesObject.EnumerateObject()
- .SelectMany(p => (reader.ToObject(p.Value) as IEnumerable<object>)!).ToArray();
- }
-
- return new Vertex(id, label, properties);
- }
- }
-}
\ No newline at end of file
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/VertexPropertyDeserializer.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/VertexPropertyDeserializer.cs
deleted file mode 100644
index e3798f6f4b..0000000000
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/VertexPropertyDeserializer.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#endregion
-
-using System.Linq;
-using System.Text.Json;
-
-namespace Gremlin.Net.Structure.IO.GraphSON
-{
- internal class VertexPropertyDeserializer : IGraphSONDeserializer
- {
- public dynamic Objectify(JsonElement graphsonObject, GraphSONReader reader)
- {
- var id = reader.ToObject(graphsonObject.GetProperty("id"));
- string label = graphsonObject.GetProperty("label").GetString()!;
- var value = reader.ToObject(graphsonObject.GetProperty("value"));
- var vertex = graphsonObject.TryGetProperty("vertex", out var vertexProperty)
- ? new Vertex(reader.ToObject(vertexProperty))
- : null;
-
- Property[] properties = System.Array.Empty<Property>();
- if (graphsonObject.TryGetProperty("properties", out var propertiesObject)
- && propertiesObject.ValueKind == JsonValueKind.Object)
- {
- properties = propertiesObject.EnumerateObject()
- .Select(p => new Property(p.Name, reader.ToObject(p.Value))).ToArray();
- }
- return new VertexProperty(id, label, value, vertex, properties);
- }
- }
-}
\ No newline at end of file
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/VertexPropertySerializer.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/VertexPropertySerializer.cs
deleted file mode 100644
index cbb8a929fc..0000000000
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/VertexPropertySerializer.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#endregion
-
-using System.Collections.Generic;
-
-namespace Gremlin.Net.Structure.IO.GraphSON
-{
- internal class VertexPropertySerializer : IGraphSONSerializer
- {
- public Dictionary<string, dynamic> Dictify(dynamic objectData, GraphSONWriter writer)
- {
- VertexProperty vertexProperty = objectData;
- var valueDict = new Dictionary<string, dynamic>
- {
- {"id", writer.ToDict(vertexProperty.Id)},
- {"label", vertexProperty.Label},
- {"value", writer.ToDict(vertexProperty.Value)}
- };
- if (vertexProperty.Vertex != null)
- {
- valueDict.Add("vertex", writer.ToDict(vertexProperty.Vertex.Id));
- }
- return GraphSONUtil.ToTypedValue(nameof(VertexProperty), valueDict);
- }
- }
-}
\ No newline at end of file
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/VertexSerializer.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/VertexSerializer.cs
deleted file mode 100644
index aef1291c4f..0000000000
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/VertexSerializer.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#endregion
-
-using System.Collections.Generic;
-
-namespace Gremlin.Net.Structure.IO.GraphSON
-{
- internal class VertexSerializer : IGraphSONSerializer
- {
- public Dictionary<string, dynamic> Dictify(dynamic objectData, GraphSONWriter writer)
- {
- Vertex vertex = objectData;
- var vertexDict = new Dictionary<string, dynamic>
- {
- {"id", writer.ToDict(vertex.Id)},
- {"label", writer.ToDict(vertex.Label)}
- };
- return GraphSONUtil.ToTypedValue(nameof(Vertex), vertexDict);
- }
- }
-}
\ No newline at end of file
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/SerializationTokens.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/SerializationTokens.cs
index 3a02fbaddf..8c180390ef 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/SerializationTokens.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/SerializationTokens.cs
@@ -1,6 +1,4 @@
-#region License
-
-/*
+/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -19,8 +17,6 @@
* under the License.
*/
-#endregion
-
namespace Gremlin.Net.Structure.IO
{
/// <summary>
@@ -28,19 +24,9 @@ namespace Gremlin.Net.Structure.IO
/// </summary>
public class SerializationTokens
{
- /// <summary>
- /// The MIME type for GraphSON 2.
- /// </summary>
- public const string GraphSON2MimeType = "application/vnd.gremlin-v2.0+json";
-
- /// <summary>
- /// The MIME type for GraphSON 3.
- /// </summary>
- public const string GraphSON3MimeType = "application/vnd.gremlin-v3.0+json";
-
/// <summary>
/// The MIME type for GraphBinary 4.0.
/// </summary>
public const string GraphBinary4MimeType = "application/vnd.graphbinary-v4.0";
}
-}
\ No newline at end of file
+}
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Docs/Dev/Provider/IndexTests.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Docs/Dev/Provider/IndexTests.cs
deleted file mode 100644
index d39190143d..0000000000
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Docs/Dev/Provider/IndexTests.cs
+++ /dev/null
@@ -1,91 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#endregion
-
-using System;
-using System.Collections.Generic;
-using System.Text.Json;
-using Gremlin.Net.Driver;
-using Gremlin.Net.Structure.IO.GraphSON;
-using Xunit;
-using Xunit.Sdk;
-
-namespace Gremlin.Net.IntegrationTest.Docs.Dev.Provider
-{
-// tag::myTypeSerialization[]
-internal class MyType
-{
- public static string GraphsonPrefix = "providerx";
- public static string GraphsonBaseType = "MyType";
- public static string GraphsonType = GraphSONUtil.FormatTypeName(GraphsonPrefix, GraphsonBaseType);
-
- public MyType(int x, int y)
- {
- X = x;
- Y = y;
- }
-
- public int X { get; }
- public int Y { get; }
-}
-
-internal class MyClassWriter : IGraphSONSerializer
-{
- public Dictionary<string, dynamic> Dictify(dynamic objectData, GraphSONWriter writer)
- {
- MyType myType = objectData;
- var valueDict = new Dictionary<string, object>
- {
- {"x", myType.X},
- {"y", myType.Y}
- };
- return GraphSONUtil.ToTypedValue(nameof(TestClass), valueDict, MyType.GraphsonPrefix);
- }
-}
-
-internal class MyTypeReader : IGraphSONDeserializer
-{
- public dynamic Objectify(JsonElement graphsonObject, GraphSONReader reader)
- {
- var x = reader.ToObject(graphsonObject.GetProperty("x"));
- var y = reader.ToObject(graphsonObject.GetProperty("y"));
- return new MyType(x, y);
- }
-}
-// end::myTypeSerialization[]
-
- public class IndexTests
- {
- [Fact(Skip="No Server under localhost")]
- public void SupportingGremlinNetIOTests()
- {
-// tag::supportingGremlinNetIO[]
-var graphsonReader = new GraphSON3Reader(
- new Dictionary<string, IGraphSONDeserializer> {{MyType.GraphsonType, new MyTypeReader()}});
-var graphsonWriter = new GraphSON3Writer(
- new Dictionary<Type, IGraphSONSerializer> {{typeof(MyType), new MyClassWriter()}});
-
-var gremlinClient = new GremlinClient(new GremlinServer("localhost", 8182), new GraphSON2MessageSerializer());
-// end::supportingGremlinNetIO[]
- }
- }
-}
\ No newline at end of file
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Docs/Reference/GremlinVariantsTests.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Docs/Reference/GremlinVariantsTests.cs
index 77c3f554dd..6b15eee466 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Docs/Reference/GremlinVariantsTests.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Docs/Reference/GremlinVariantsTests.cs
@@ -30,7 +30,6 @@ using Gremlin.Net.IntegrationTest.Process.Traversal.DriverRemoteConnection;
using Gremlin.Net.Process.Traversal;
using Gremlin.Net.Process.Traversal.Strategy.Decoration;
using Gremlin.Net.Structure.IO.GraphBinary4;
-using Gremlin.Net.Structure.IO.GraphSON;
using Microsoft.Extensions.Logging;
using Xunit;
// tag::commonImports[]
@@ -85,22 +84,6 @@ var client = new GremlinClient(new GremlinServer("localhost", 8182), new GraphBi
// end::serializationBinary[]
}
- [Fact(Skip="No Server under localhost")]
- public void SerializationGraphson2Test()
- {
-// tag::serializationGraphSon[]
-var client = new GremlinClient(new GremlinServer("localhost", 8182), new GraphSON2MessageSerializer());
-// end::serializationGraphSon[]
- }
-
- [Fact(Skip = "No Server under localhost")]
- public void SerializationGraphson3Test()
- {
-// tag::serializationGraphSon3[]
-var client = new GremlinClient(new GremlinServer("localhost", 8182), new GraphSON3MessageSerializer());
-// end::serializationGraphSon3[]
- }
-
[Fact(Skip="We can't apply strategies")]
public void TraversalStrategiesTest()
{
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Driver/PropertyDeserializationTests.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Driver/PropertyDeserializationTests.cs
index 1191761674..01cd0b266c 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Driver/PropertyDeserializationTests.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Driver/PropertyDeserializationTests.cs
@@ -27,7 +27,6 @@ using Gremlin.Net.IntegrationTest.Process.Traversal.DriverRemoteConnection;
using Gremlin.Net.Process.Traversal;
using Gremlin.Net.Structure;
using Gremlin.Net.Structure.IO.GraphBinary4;
-using Gremlin.Net.Structure.IO.GraphSON;
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
@@ -306,21 +305,9 @@ namespace Gremlin.Net.IntegrationTest.Driver
Assert.True((element.Properties?.Length ?? 0) == 0);
}
- // TODO: Remove GraphSON serializer tests entirely once GraphSON support is fully removed from the driver.
- // GraphSON 2/3 serializers are not compatible with the HTTP 4.0 transport (they use WebSocket-style
- // MIME-type framing and the server only accepts GraphBinary 4.0 or GraphSON 4.0 over HTTP).
public static List<object[]> Serializers => new()
{
new object[] { new GraphBinary4MessageSerializer() }
};
-
- [Fact(Skip = "GraphSON 2/3 serializers are not supported over HTTP 4.0 transport")]
- public void GraphSONSerializersNotSupportedOverHttp()
- {
- // TODO: Remove this test and the GraphSON serializer references when GraphSON is fully removed.
- // GraphSON2MessageSerializer and GraphSON3MessageSerializer use WebSocket-style MIME-type framing
- // that is incompatible with the HTTP channelizer. The server only accepts GraphBinary 4.0 or
- // GraphSON 4.0 (application/json) over HTTP.
- }
}
}
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Process/Traversal/DriverRemoteConnection/GraphTraversalSourceTests.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Process/Traversal/DriverRemoteConnection/GraphTraversalSourceTests.cs
index 9348c02f41..45c3b0c561 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Process/Traversal/DriverRemoteConnection/GraphTraversalSourceTests.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Process/Traversal/DriverRemoteConnection/GraphTraversalSourceTests.cs
@@ -50,17 +50,6 @@ namespace Gremlin.Net.IntegrationTest.Process.Traversal.DriverRemoteConnection
Assert.Contains("peter", results);
}
- // TODO: Groovy lambdas are not supported in the GremlinLang/GraphBinary4 serialization path
- [Fact(Skip = "Groovy lambdas are not serializable over HTTP 4.0 with GraphBinary4")]
- public void ShouldHandleLambdasInWithSack()
- {
- var connection = _connectionFactory.CreateRemoteConnection();
- var g = AnonymousTraversalSource.Traversal().With(connection);
- Assert.Equal(24.0, g.WithSack(1.0, (IUnaryOperator) Lambda.Groovy("x -> x + 1")).V().Both().Sack<double>().Sum<double>().Next());
- Assert.Equal(24.0, g.WithSack((ISupplier) Lambda.Groovy("{1.0d}"), (IUnaryOperator) Lambda.Groovy("x -> x + 1")).V().Both().Sack<double>().Sum<double>().Next());
- Assert.Equal(48.0, g.WithSack(1.0, (IBinaryOperator) Lambda.Groovy("x, y -> x + y + 1")).V().Both().Sack<double>().Sum<double>().Next());
- Assert.Equal(48.0, g.WithSack((ISupplier) Lambda.Groovy("{1.0d}"), (IBinaryOperator) Lambda.Groovy("x, y -> x + y + 1")).V().Both().Sack<double>().Sum<double>().Next());
- }
}
}
\ No newline at end of file
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Process/Traversal/GraphSONWriterTests.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Process/Traversal/GraphSONWriterTests.cs
deleted file mode 100644
index 0490700027..0000000000
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Process/Traversal/GraphSONWriterTests.cs
+++ /dev/null
@@ -1,64 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#endregion
-
-using System.Collections.Generic;
-using Gremlin.Net.Process.Traversal;
-using Gremlin.Net.Structure.IO.GraphSON;
-using Xunit;
-
-namespace Gremlin.Net.IntegrationTest.Process.Traversal
-{
- public class GraphSONWriterTests
- {
- /// <summary>
- /// Parameters for each test supporting multiple versions of GraphSON
- /// </summary>
- public static IEnumerable<object[]> Versions => new []
- {
- new object[] { 2 },
- new object[] { 3 }
- };
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldSerializeLongPredicateCorrectly(int version)
- {
- var writer = CreateGraphSONWriter(version);
- var predicate = P.Lt("b").Or(P.Gt("c")).And(P.Neq("d"));
-
- var graphSon = writer.WriteObject(predicate);
-
- const string expected =
- "{\"@type\":\"g:P\",\"@value\":{\"predicate\":\"and\",\"value\":[{\"@type\":\"g:P\",\"@value\":{\"predicate\":\"or\",\"value\":[{\"@type\":\"g:P\",\"@value\":{\"predicate\":\"lt\",\"value\":\"b\"}},{\"@type\":\"g:P\",\"@value\":{\"predicate\":\"gt\",\"value\":\"c\"}}]}},{\"@type\":\"g:P\",\"@value\":{\"predicate\":\"neq\",\"value\":\"d\"}}]}}";
- Assert.Equal(expected, graphSon);
- }
-
- private GraphSONWriter CreateGraphSONWriter(int version)
- {
- if (version == 3)
- {
- return new GraphSON3Writer();
- }
- return new GraphSON2Writer();
- }
- }
-}
\ No newline at end of file
diff --git a/gremlin-dotnet/test/Gremlin.Net.UnitTest/Driver/GraphSONMessageSerializerTests.cs b/gremlin-dotnet/test/Gremlin.Net.UnitTest/Driver/GraphSONMessageSerializerTests.cs
deleted file mode 100644
index 4657eb1870..0000000000
--- a/gremlin-dotnet/test/Gremlin.Net.UnitTest/Driver/GraphSONMessageSerializerTests.cs
+++ /dev/null
@@ -1,83 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#endregion
-
-using System;
-using System.Text;
-using System.Threading.Tasks;
-using Gremlin.Net.Structure.IO.GraphSON;
-using Xunit;
-
-namespace Gremlin.Net.UnitTest.Driver
-{
- public class GraphSONMessageSerializerTests
- {
- [Fact]
- public async Task DeserializingNullThrows()
- {
- var sut = CreateMessageSerializer();
-
- await Assert.ThrowsAsync<ArgumentNullException>(() => sut.DeserializeMessageAsync(null!));
- }
-
- [Fact]
- public async Task EmptyArrayDeserializedIntoEmptyResult()
- {
- var sut = CreateMessageSerializer();
-
- var result = await sut.DeserializeMessageAsync(new byte[0]);
-
- Assert.NotNull(result);
- Assert.Empty(result.Result);
- Assert.Equal(200, result.StatusCode);
- }
-
- [Fact]
- public async Task EmptyStringDeserializedIntoEmptyResult()
- {
- var sut = CreateMessageSerializer();
- var ofEmpty = Encoding.UTF8.GetBytes("");
-
- var result = await sut.DeserializeMessageAsync(ofEmpty);
-
- Assert.NotNull(result);
- Assert.Empty(result.Result);
- }
-
- [Fact]
- public async Task JsonNullDeserializedIntoEmptyResult()
- {
- var sut = CreateMessageSerializer();
- var ofNull = Encoding.UTF8.GetBytes("null");
-
- var result = await sut.DeserializeMessageAsync(ofNull);
-
- Assert.NotNull(result);
- Assert.Empty(result.Result);
- }
-
- private static GraphSONMessageSerializer CreateMessageSerializer()
- {
- return new GraphSON3MessageSerializer(new GraphSON3Reader(), new GraphSON3Writer());
- }
- }
-}
diff --git a/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSON3MessageSerializerTests.cs b/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSON3MessageSerializerTests.cs
deleted file mode 100644
index e9d37059ad..0000000000
--- a/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSON3MessageSerializerTests.cs
+++ /dev/null
@@ -1,58 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#endregion
-
-using System;
-using System.Threading;
-using System.Threading.Tasks;
-using Gremlin.Net.Driver.Messages;
-using Gremlin.Net.Structure.IO.GraphSON;
-using Xunit;
-
-namespace Gremlin.Net.UnitTest.Structure.IO.GraphSON;
-
-public class GraphSON3MessageSerializerTests
-{
- [Fact]
- public async Task SerializeMessageAsyncShouldSupportCancellation()
- {
- var serializer = CreateMessageSerializer();
-
- await Assert.ThrowsAsync<OperationCanceledException>(async () =>
- await serializer.SerializeMessageAsync(RequestMessage.Build(string.Empty).Create(),
- new CancellationToken(true)));
- }
-
- [Fact]
- public async Task DeserializeMessageAsyncShouldSupportCancellation()
- {
- var serializer = CreateMessageSerializer();
-
- await Assert.ThrowsAsync<OperationCanceledException>(async () =>
- await serializer.DeserializeMessageAsync(Array.Empty<byte>(), new CancellationToken(true)));
- }
-
- private static GraphSON3MessageSerializer CreateMessageSerializer()
- {
- return new GraphSON3MessageSerializer();
- }
-}
\ No newline at end of file
diff --git a/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONReaderTests.cs b/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONReaderTests.cs
deleted file mode 100644
index b4a7fe8544..0000000000
--- a/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONReaderTests.cs
+++ /dev/null
@@ -1,708 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#endregion
-
-using System;
-using System.Collections.Generic;
-using System.Numerics;
-using System.Text.Json;
-using Gremlin.Net.Process.Traversal;
-using Gremlin.Net.Structure;
-using Gremlin.Net.Structure.IO.GraphSON;
-using NSubstitute;
-using Xunit;
-
-namespace Gremlin.Net.UnitTest.Structure.IO.GraphSON
-{
- public class GraphSONReaderTests
- {
- /// <summary>
- /// Parameters for each test supporting multiple versions of GraphSON
- /// </summary>
- public static IEnumerable<object[]> Versions => new []
- {
- new object[] { 2 },
- new object[] { 3 }
- };
-
- /// <summary>
- /// Parameters for each collections test supporting multiple versions of GraphSON
- /// </summary>
- public static IEnumerable<object[]> VersionsSupportingCollections => new []
- {
- new object[] { 3 }
- };
-
- private GraphSONReader CreateStandardGraphSONReader(int version)
- {
- if (version == 3)
- {
- return new GraphSON3Reader();
- }
- return new GraphSON2Reader();
- }
-
- [Fact]
- public void ShouldDeserializeWithCustomDeserializerForNewType()
- {
- var deserializerByGraphSONType = new Dictionary<string, IGraphSONDeserializer>
- {
- {"NS:TestClass", new TestGraphSONDeserializer()}
- };
- var reader = new GraphSON2Reader(deserializerByGraphSONType);
- const string graphSON = "{\"@type\":\"NS:TestClass\",\"@value\":\"test\"}";
-
- var jsonElement = JsonSerializer.Deserialize<JsonElement>(graphSON);
- var deserializedValue = reader.ToObject(jsonElement);
-
- Assert.Equal("test", deserializedValue!.Value);
- }
-
- [Fact]
- public void ShouldDeserializeWithCustomDeserializerForCommonType()
- {
- var customSerializerMock = Substitute.For<IGraphSONDeserializer>();
- const string overrideTypeString = "g:Int64";
- var customSerializerByType = new Dictionary<string, IGraphSONDeserializer>
- {
- {overrideTypeString, customSerializerMock}
- };
- var reader = new GraphSON2Reader(customSerializerByType);
-
- var jsonElement =
- JsonSerializer.Deserialize<JsonElement>($"{{\"@type\":\"{overrideTypeString}\",\"@value\":12}}");
- var deserializedValue = reader.ToObject(jsonElement);
-
- customSerializerMock.Received(1).Objectify(Arg.Any<JsonElement>(), Arg.Any<GraphSONReader>());
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldDeserializeDateToDateTimeOffset(int version)
- {
- const string graphSon = "{\"@type\":\"g:Date\",\"@value\":1475583442552}";
- var reader = CreateStandardGraphSONReader(version);
-
- var jsonElement = JsonSerializer.Deserialize<JsonElement>(graphSon);
- var deserializedValue = reader.ToObject(jsonElement);
-
- var expectedDateTimeOffset = TestUtils.FromJavaTime(1475583442552);
- Assert.Equal(expectedDateTimeOffset, deserializedValue);
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldDeserializeDictionary(int version)
- {
- const string serializedDict = "{\"age\":[{\"@type\":\"g:Int32\", \"@value\":29}], \"name\":[\"marko\"], " +
- "\"gender\": null}";
- var reader = CreateStandardGraphSONReader(version);
-
- var jsonElement = JsonSerializer.Deserialize<JsonElement>(serializedDict);
- var deserializedValue = reader.ToObject(jsonElement);
-
- var expectedDict = new Dictionary<string, dynamic?>
- {
- {"age", new List<object> {29}},
- {"name", new List<object> {"marko"}},
- {"gender", null}
- };
- Assert.Equal(expectedDict, deserializedValue);
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldDeserializeEdge(int version)
- {
- const string graphSon = "{\"@type\":\"g:Edge\", \"@value\":{\"id\":{\"@type\":\"g:Int64\", \"@value\":17}, " +
- "\"label\":\"knows\", \"inV\":\"x\", \"outV\":\"y\", \"inVLabel\":\"xLab\", " +
- "\"properties\":{\"aKey\":\"aValue\", \"bKey\":true}}}";
- var reader = CreateStandardGraphSONReader(version);
-
- var jsonElement = JsonSerializer.Deserialize<JsonElement>(graphSon);
- Edge readEdge = reader.ToObject(jsonElement)!;
-
- Assert.Equal((long) 17, readEdge.Id);
- Assert.Equal("knows", readEdge.Label);
- Assert.Equal(new Vertex("x", "xLabel"), readEdge.InV);
- Assert.Equal(new Vertex("y"), readEdge.OutV);
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldDeserializeInt(int version)
- {
- var serializedValue = "{\"@type\":\"g:Int32\",\"@value\":5}";
- var reader = CreateStandardGraphSONReader(version);
-
- var jsonElement = JsonSerializer.Deserialize<JsonElement>(serializedValue);
- var deserializedValue = reader.ToObject(jsonElement);
-
- Assert.Equal(5, deserializedValue);
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldDeserializeLong(int version)
- {
- const string serializedValue = "{\"@type\":\"g:Int64\",\"@value\":5}";
- var reader = CreateStandardGraphSONReader(version);
-
- var jsonElement = JsonSerializer.Deserialize<JsonElement>(serializedValue);
- var deserializedValue = reader.ToObject(jsonElement);
-
- Assert.Equal((long) 5, deserializedValue);
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldDeserializeFloat(int version)
- {
- const string serializedValue = "{\"@type\":\"g:Float\",\"@value\":31.3}";
- var reader = CreateStandardGraphSONReader(version);
-
- var jsonElement = JsonSerializer.Deserialize<JsonElement>(serializedValue);
- var deserializedValue = reader.ToObject(jsonElement);
-
- Assert.Equal((float) 31.3, deserializedValue);
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldDeserializeDouble(int version)
- {
- const string serializedValue = "{\"@type\":\"g:Double\",\"@value\":31.2}";
- var reader = CreateStandardGraphSONReader(version);
-
- var jsonElement = JsonSerializer.Deserialize<JsonElement>(serializedValue);
- var deserializedValue = reader.ToObject(jsonElement);
-
- Assert.Equal(31.2, deserializedValue);
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldDeserializeNaN(int version)
- {
- const string serializedValue = "{\"@type\":\"g:Double\",\"@value\":\"NaN\"}";
- var reader = CreateStandardGraphSONReader(version);
-
- var jsonElement = JsonSerializer.Deserialize<JsonElement>(serializedValue);
- var deserializedValue = reader.ToObject(jsonElement);
-
- Assert.Equal(Double.NaN, deserializedValue);
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldDeserializePositiveInfinity(int version)
- {
- const string serializedValue = "{\"@type\":\"g:Double\",\"@value\":\"Infinity\"}";
- var reader = CreateStandardGraphSONReader(version);
-
- var jsonElement = JsonSerializer.Deserialize<JsonElement>(serializedValue);
- var deserializedValue = reader.ToObject(jsonElement);
-
- Assert.Equal(double.PositiveInfinity, deserializedValue);
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldDeserializeNegativeInfinity(int version)
- {
- const string serializedValue = "{\"@type\":\"g:Double\",\"@value\":\"-Infinity\"}";
- var reader = CreateStandardGraphSONReader(version);
-
- var jsonElement = JsonSerializer.Deserialize<JsonElement>(serializedValue);
- var deserializedValue = reader.ToObject(jsonElement);
-
- Assert.Equal(double.NegativeInfinity, deserializedValue);
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldDeserializeDecimal(int version)
- {
- const string serializedValue = "{\"@type\":\"gx:BigDecimal\",\"@value\":-8.201}";
- var reader = CreateStandardGraphSONReader(version);
-
- var jsonElement = JsonSerializer.Deserialize<JsonElement>(serializedValue);
- var deserializedValue = reader.ToObject(jsonElement);
-
- Assert.Equal(-8.201M, deserializedValue);
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldDeserializeDecimalValueAsString(int version)
- {
- const string serializedValue = "{\"@type\":\"gx:BigDecimal\",\"@value\":\"7.50\"}";
- var reader = CreateStandardGraphSONReader(version);
-
- var jsonElement = JsonSerializer.Deserialize<JsonElement>(serializedValue);
- decimal deserializedValue = reader.ToObject(jsonElement);
-
- Assert.Equal(7.5M, deserializedValue);
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldDeserializeByte(int version)
- {
- const string serializedValue = "{\"@type\":\"gx:Byte\",\"@value\":1}";
- var reader = CreateStandardGraphSONReader(version);
-
- var jsonElement = JsonSerializer.Deserialize<JsonElement>(serializedValue);
- var deserializedValue = reader.ToObject(jsonElement);
-
- Assert.Equal(1, deserializedValue);
- Assert.IsType<sbyte>(deserializedValue);
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldDeserializeByteNegative(int version)
- {
- const string serializedValue = "{\"@type\":\"gx:Byte\",\"@value\":-42}";
- var reader = CreateStandardGraphSONReader(version);
-
- var jsonElement = JsonSerializer.Deserialize<JsonElement>(serializedValue);
- var deserializedValue = reader.ToObject(jsonElement);
-
- Assert.Equal(-42, deserializedValue);
- Assert.IsType<sbyte>(deserializedValue);
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldDeserializeChar(int version)
- {
- const string serializedValue = "{\"@type\":\"gx:Char\",\"@value\":\"x\"}";
- var reader = CreateStandardGraphSONReader(version);
-
- var jsonElement = JsonSerializer.Deserialize<JsonElement>(serializedValue);
- var deserializedValue = reader.ToObject(jsonElement);
-
- Assert.Equal('x', deserializedValue);
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldDeserializeList(int version)
- {
- const string serializedValue = "[{\"@type\":\"g:Int32\", \"@value\":5}, {\"@type\":\"g:Int32\", " +
- "\"@value\":6}, null]";
- var reader = CreateStandardGraphSONReader(version);
-
- var jsonElement = JsonSerializer.Deserialize<JsonElement>(serializedValue);
- var deserializedValue = reader.ToObject(jsonElement);
-
- Assert.Equal(new List<object?> {5, 6, null}, deserializedValue);
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldDeserializeT(int version)
- {
- const string graphSon = "{\"@type\":\"g:T\",\"@value\":\"label\"}";
- var reader = CreateStandardGraphSONReader(version);
-
- var jsonElement = JsonSerializer.Deserialize<JsonElement>(graphSon);
- T readT = reader.ToObject(jsonElement)!;
-
- Assert.Equal(T.Label, readT);
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldDeserializeDirection(int version)
- {
- const string serializedValue = "{\"@type\":\"g:Direction\",\"@value\":\"OUT\"}";
- var reader = CreateStandardGraphSONReader(version);
-
- var jsonElement = JsonSerializer.Deserialize<JsonElement>(serializedValue);
- var deserializedValue = reader.ToObject(jsonElement);
-
- Assert.Equal(Direction.Out, deserializedValue);
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldDeserializeDT(int version)
- {
- const string serializedValue = "{\"@type\":\"g:DT\",\"@value\":\"minute\"}";
- var reader = CreateStandardGraphSONReader(version);
-
- var jsonElement = JsonSerializer.Deserialize<JsonElement>(serializedValue);
- var deserializedValue = reader.ToObject(jsonElement);
-
- Assert.Equal(DT.Minute, deserializedValue);
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldDeserializeMerge(int version)
- {
- const string serializedValue = "{\"@type\":\"g:Merge\",\"@value\":\"onMatch\"}";
- var reader = CreateStandardGraphSONReader(version);
-
- var jsonElement = JsonSerializer.Deserialize<JsonElement>(serializedValue);
- var deserializedValue = reader.ToObject(jsonElement);
-
- Assert.Equal(Merge.OnMatch, deserializedValue);
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldDeserializeGType(int version)
- {
- const string serializedValue = "{\"@type\":\"g:GType\",\"@value\":\"BYTE\"}";
- var reader = CreateStandardGraphSONReader(version);
-
- var jsonElement = JsonSerializer.Deserialize<JsonElement>(serializedValue);
- var deserializedValue = reader.ToObject(jsonElement);
-
- Assert.Equal(GType.Byte, deserializedValue);
- }
-
- [Fact]
- public void ShouldDeserializePathFromGraphSON2()
- {
- const string graphSon =
- "{\"@type\":\"g:Path\",\"@value\":{\"labels\":[[\"a\"],[\"b\",\"c\"],[]],\"objects\":[{\"@type\":\"g:Vertex\",\"@value\":{\"id\":{\"@type\":\"g:Int32\",\"@value\":1},\"label\":\"person\",\"properties\":{\"name\":[{\"@type\":\"g:VertexProperty\",\"@value\":{\"id\":{\"@type\":\"g:Int64\",\"@value\":0},\"value\":\"marko\",\"label\":\"name\"}}],\"age\":[{\"@type\":\"g:VertexProperty\",\"@value\":{\"id\":{\"@type\":\"g:Int64\",\"@value\":1},\"value\":{\"@type\":\"g:Int32\",\"@ [...]
- var reader = CreateStandardGraphSONReader(2);
-
- var jsonElement = JsonSerializer.Deserialize<JsonElement>(graphSon);
- Path readPath = reader.ToObject(jsonElement)!;
-
- Assert.Equal("path[v[1], v[3], lop]", readPath.ToString());
- Assert.Equal(new Vertex(1), readPath[0]);
- Assert.Equal(new Vertex(1), readPath["a"]);
- Assert.Equal("lop", readPath[2]);
- Assert.Equal(3, readPath.Count);
- }
-
- [Fact]
- public void ShouldDeserializePathFromGraphSON3()
- {
- const string graphSon = "{\"@type\":\"g:Path\",\"@value\":{" +
- "\"labels\":{\"@type\":\"g:List\",\"@value\":[{\"@type\":\"g:Set\",\"@value\":[\"z\"]}]}," +
- "\"objects\":{\"@type\":\"g:List\",\"@value\":[{\"@type\":\"g:Vertex\",\"@value\":{\"id\":{\"@type\":\"g:Int64\",\"@value\":5},\"label\":\"\"}}]}}}";
- var reader = CreateStandardGraphSONReader(3);
-
- var jsonElement = JsonSerializer.Deserialize<JsonElement>(graphSon);
- Path readPath = reader.ToObject(jsonElement)!;
-
- Assert.Equal("path[v[5]]", readPath.ToString());
- Assert.Equal(new Vertex(5L), readPath[0]);
- Assert.Equal(new Vertex(5L), readPath["z"]);
- Assert.Single(readPath);
- Assert.Empty(readPath[0]!.Properties);
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldDeserializePropertyWithEdgeElement(int version)
- {
- const string graphSon = "{\"@type\":\"g:Property\", \"@value\":{\"key\":\"aKey\", " +
- "\"value\":{\"@type\":\"g:Int64\", \"@value\":17}, " +
- "\"element\":{\"@type\":\"g:Edge\", \"@value\":{\"id\":{\"@type\":\"g:Int64\", " +
- "\"@value\":122}, \"label\":\"knows\", \"inV\":\"x\", \"outV\":\"y\", " +
- "\"inVLabel\":\"xLab\"}}}}";
- var reader = CreateStandardGraphSONReader(version);
-
- var jsonElement = JsonSerializer.Deserialize<JsonElement>(graphSon);
- Property readProperty = reader.ToObject(jsonElement)!;
-
- Assert.Equal("aKey", readProperty.Key);
- Assert.Equal((long) 17, readProperty.Value);
- Assert.Equal(typeof(Edge), readProperty.Element!.GetType());
- var edge = readProperty.Element as Edge;
- Assert.Equal((long) 122, edge!.Id);
- Assert.Equal("knows", edge.Label);
- Assert.Equal("x", edge.InV.Id);
- Assert.Equal("y", edge.OutV.Id);
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldDeserializeTimestampToDateTimeOffset(int version)
- {
- const string graphSon = "{\"@type\":\"g:Timestamp\",\"@value\":1475583442558}";
- var reader = CreateStandardGraphSONReader(version);
-
- var jsonElement = JsonSerializer.Deserialize<JsonElement>(graphSon);
- var deserializedValue = reader.ToObject(jsonElement);
-
- var expectedDateTimeOffset = TestUtils.FromJavaTime(1475583442558);
- Assert.Equal(expectedDateTimeOffset, deserializedValue);
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldDeserializeGuid(int version)
- {
- const string graphSon = "{\"@type\":\"g:UUID\",\"@value\":\"41d2e28a-20a4-4ab0-b379-d810dede3786\"}";
- var reader = CreateStandardGraphSONReader(version);
-
- var jsonElement = JsonSerializer.Deserialize<JsonElement>(graphSon);
- var deserializedValue = reader.ToObject(jsonElement);
-
- Assert.Equal(Guid.Parse("41d2e28a-20a4-4ab0-b379-d810dede3786"), deserializedValue);
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldDeserializeVertexProperty(int version)
- {
- const string graphSon = "{\"@type\":\"g:VertexProperty\", \"@value\":{\"id\":\"anId\", \"label\":\"aKey\", " +
- "\"value\":true, \"vertex\":{\"@type\":\"g:Int32\", \"@value\":9}}}";
- var reader = CreateStandardGraphSONReader(version);
-
- var jsonElement = JsonSerializer.Deserialize<JsonElement>(graphSon);
- VertexProperty readVertexProperty = reader.ToObject(jsonElement)!;
-
- Assert.Equal("anId", readVertexProperty.Id);
- Assert.Equal("aKey", readVertexProperty.Label);
- Assert.True(readVertexProperty.Value);
- Assert.NotNull(readVertexProperty.Vertex);
- Assert.Empty(readVertexProperty.Properties);
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldDeserializeVertexPropertyWithLabel(int version)
- {
- const string graphSon = "{\"@type\":\"g:VertexProperty\", \"@value\":{\"id\":{\"@type\":\"g:Int32\", " +
- "\"@value\":1}, \"label\":\"name\", \"value\":\"marko\"}}";
- var reader = CreateStandardGraphSONReader(version);
-
- var jsonElement = JsonSerializer.Deserialize<JsonElement>(graphSon);
- VertexProperty readVertexProperty = reader.ToObject(jsonElement)!;
-
- Assert.Equal(1, readVertexProperty.Id);
- Assert.Equal("name", readVertexProperty.Label);
- Assert.Equal("marko", readVertexProperty.Value);
- Assert.Null(readVertexProperty.Vertex);
- Assert.Empty(readVertexProperty.Properties);
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldDeserializeVertex(int version)
- {
- const string graphSon = "{\"@type\":\"g:Vertex\", \"@value\":{\"id\":{\"@type\":\"g:Float\", " +
- "\"@value\":45.23}}}";
- var reader = CreateStandardGraphSONReader(version);
-
- var jsonElement = JsonSerializer.Deserialize<JsonElement>(graphSon);
- var deserializedValue = reader.ToObject(jsonElement);
-
- Assert.Equal(new Vertex(45.23f), deserializedValue);
- Assert.Empty(deserializedValue!.Properties);
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldDeserializeVertexWithLabel(int version)
- {
- const string graphSon = "{\"@type\":\"g:Vertex\", \"@value\":{\"id\":{\"@type\":\"g:Float\", " +
- "\"@value\":45.23}, \"label\": \"person\"}}";
- var reader = CreateStandardGraphSONReader(version);
-
- var jsonElement = JsonSerializer.Deserialize<JsonElement>(graphSon);
- Vertex deserializedValue = reader.ToObject(jsonElement)!;
-
- Assert.Equal("person", deserializedValue.Label);
- Assert.Empty(deserializedValue.Properties);
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldDeserializeVertexWithEdges(int version)
- {
- const string graphSon =
- "{\"@type\":\"g:Vertex\", \"@value\":{\"id\":{\"@type\":\"g:Int32\",\"@value\":1},\"label\":\"person\",\"outE\":{\"created\":[{\"id\":{\"@type\":\"g:Int32\",\"@value\":9},\"inV\":{\"@type\":\"g:Int32\",\"@value\":3},\"properties\":{\"weight\":{\"@type\":\"g:Double\",\"@value\":0.4}}}],\"knows\":[{\"id\":{\"@type\":\"g:Int32\",\"@value\":7},\"inV\":{\"@type\":\"g:Int32\",\"@value\":2},\"properties\":{\"weight\":{\"@type\":\"g:Double\",\"@value\":0.5}}},{\"id\":{\"@type\":\ [...]
- var reader = CreateStandardGraphSONReader(version);
-
- var jsonElement = JsonSerializer.Deserialize<JsonElement>(graphSon);
- Vertex readVertex = reader.ToObject(jsonElement)!;
-
- Assert.Equal(new Vertex(1), readVertex);
- Assert.Equal("person", readVertex.Label);
- Assert.Equal(typeof(int), readVertex.Id!.GetType());
- }
-
- [Theory, MemberData(nameof(VersionsSupportingCollections))]
- public void ShouldDeserializeEmptyGList(int version)
- {
- const string graphSon = "{\"@type\":\"g:List\", \"@value\": []}";
- var reader = CreateStandardGraphSONReader(version);
-
- var jsonElement = JsonSerializer.Deserialize<JsonElement>(graphSon);
- object[] deserializedValue = reader.ToObject(jsonElement);
-
- Assert.Equal(Array.Empty<object>(), deserializedValue);
- }
-
- [Theory, MemberData(nameof(VersionsSupportingCollections))]
- public void ShouldDeserializeGList(int version)
- {
- const string json = "{\"@type\":\"g:List\", \"@value\": [{\"@type\": \"g:Int32\", \"@value\": 1}," +
- "{\"@type\": \"g:Int32\", \"@value\": 2}, {\"@type\": \"g:Int32\", \"@value\": 3}]}";
- var reader = CreateStandardGraphSONReader(version);
-
- var jsonElement = JsonSerializer.Deserialize<JsonElement>(json);
- var deserializedValue = reader.ToObject(jsonElement);
-
- Assert.Equal((IList<object>)new object[] { 1, 2, 3}, deserializedValue);
- }
-
- [Theory, MemberData(nameof(VersionsSupportingCollections))]
- public void ShouldDeserializeGSet(int version)
- {
- const string graphSon = "{\"@type\":\"g:Set\", \"@value\": [{\"@type\": \"g:Int32\", \"@value\": 1}," +
- "{\"@type\": \"g:Int32\", \"@value\": 2}, {\"@type\": \"g:Int32\", \"@value\": 3}]}";
- var reader = CreateStandardGraphSONReader(version);
-
- var jsonElement = JsonSerializer.Deserialize<JsonElement>(graphSon);
- var deserializedValue = reader.ToObject(jsonElement);
-
- Assert.Equal((ISet<object>)new HashSet<object>{ 1, 2, 3}, deserializedValue);
- }
-
- [Theory, MemberData(nameof(VersionsSupportingCollections))]
- public void ShouldDeserializeGMap(int version)
- {
- const string json = "{\"@type\":\"g:Map\", \"@value\": [\"a\",{\"@type\": \"g:Int32\", \"@value\": 1}, " +
- "\"b\", {\"@type\": \"g:Int32\", \"@value\": 2}]}";
- var reader = CreateStandardGraphSONReader(version);
-
- var jsonElement = JsonSerializer.Deserialize<JsonElement>(json);
- var deserializedValue = reader.ToObject(jsonElement);
-
- Assert.Equal(new Dictionary<object, object>{ { "a", 1 }, { "b", 2 }}, deserializedValue);
- }
-
- [Theory, MemberData(nameof(VersionsSupportingCollections))]
- public void ShouldDeserializeGMapWithNonStringKeys(int version)
- {
- const string json = "{\"@type\":\"g:Map\", \"@value\": [{\"@type\":\"g:Int32\", \"@value\":123}, \"red\"]}";
- var reader = CreateStandardGraphSONReader(version);
-
- var jsonElement = JsonSerializer.Deserialize<JsonElement>(json);
- var deserializedValue = reader.ToObject(jsonElement);
-
- Assert.Equal(new Dictionary<object, object>{ { 123, "red" }}, deserializedValue);
- }
-
- [Theory, MemberData(nameof(VersionsSupportingCollections))]
- public void ShouldDeserializeBulkSet(int version)
- {
- const string graphSon = "{\"@type\": \"g:BulkSet\", \"@value\": [" +
- "\"marko\", {\"@type\": \"g:Int64\", \"@value\": 1}, " +
- "\"josh\", {\"@type\": \"g:Int64\", \"@value\": 3}]}";
- var reader = CreateStandardGraphSONReader(version);
-
- var jsonElement = JsonSerializer.Deserialize<JsonElement>(graphSon);
- var deserializedValue = reader.ToObject(jsonElement);
-
- Assert.Equal(new List<object>{ "marko", "josh", "josh", "josh" }, deserializedValue);
- }
-
- [Fact]
- public void ShouldDeserializeBulkSetWithGraphSON3()
- {
- const string graphSon =
- "{\"@type\":\"g:List\",\"@value\":[{\"@type\":\"g:Traverser\",\"@value\":{\"bulk\":{\"@type\":\"g:Int64\",\"@value\":1},\"value\":{\"@type\":\"g:BulkSet\",\"@value\":[{\"@type\":\"g:Int64\",\"@value\":1},{\"@type\":\"g:Int64\",\"@value\":2},{\"@type\":\"g:Int64\",\"@value\":0},{\"@type\":\"g:Int64\",\"@value\":3},{\"@type\":\"g:Int64\",\"@value\":2},{\"@type\":\"g:Int64\",\"@value\":1},{\"@type\":\"g:Double\",\"@value\":1.0},{\"@type\":\"g:Int64\",\"@value\":2}]}}}]}";
- var reader = CreateStandardGraphSONReader(3);
-
- var jsonElement = JsonSerializer.Deserialize<JsonElement>(graphSon);
- var deserializedValue = reader.ToObject(jsonElement);
- }
-
- [Theory, MemberData(nameof(VersionsSupportingCollections))]
- public void ShouldDeserializeTraverser(int version)
- {
- const string json = "{\"@type\":\"g:Traverser\", \"@value\":{\"bulk\":{\"@type\":\"g:Int64\", " +
- "\"@value\":10}, \"value\":{\"@type\":\"g:Int32\", \"@value\":1}}}";
- var reader = CreateStandardGraphSONReader(version);
-
- var jsonElement = JsonSerializer.Deserialize<JsonElement>(json);
- Traverser deserializedValue = reader.ToObject(jsonElement)!;
-
- Assert.Equal(10, deserializedValue.Bulk);
- Assert.Equal(1, deserializedValue.Object);
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldDeserializeDurationToTimeSpan(int version)
- {
- const string graphSon = "{\"@type\":\"gx:Duration\",\"@value\":\"PT120H\"}";
- var reader = CreateStandardGraphSONReader(version);
-
- var jsonElement = JsonSerializer.Deserialize<JsonElement>(graphSon);
- var deserializedValue = reader.ToObject(jsonElement);
-
- Assert.Equal(TimeSpan.FromDays(5), deserializedValue);
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldDeserializeBigInteger(int version)
- {
- var graphSon = "{\"@type\":\"gx:BigInteger\",\"@value\":123456789}";
- var reader = CreateStandardGraphSONReader(version);
-
- var jsonElement = JsonSerializer.Deserialize<JsonElement>(graphSon);
- var deserializedValue = reader.ToObject(jsonElement);
-
- Assert.Equal(BigInteger.Parse("123456789"), deserializedValue);
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldDeserializeBigIntegerValueAsString(int version)
- {
- var graphSon = "{\"@type\":\"gx:BigInteger\", \"@value\":\"123456789\"}";
- var reader = CreateStandardGraphSONReader(version);
-
- var jsonElement = JsonSerializer.Deserialize<JsonElement>(graphSon);
- var deserializedValue = reader.ToObject(jsonElement);
-
- Assert.Equal(BigInteger.Parse("123456789"), deserializedValue);
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldDeserializeReallyBigIntegerValue(int version)
- {
- const string graphSon = "{\"@type\":\"gx:BigInteger\", \"@value\":123456789987654321123456789987654321}";
- var reader = CreateStandardGraphSONReader(version);
-
- var jsonElement = JsonSerializer.Deserialize<JsonElement>(graphSon);
- var deserializedValue = reader.ToObject(jsonElement);
-
- Assert.Equal(BigInteger.Parse("123456789987654321123456789987654321"), deserializedValue);
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldDeserializeByteBuffer(int version)
- {
- const string graphSon = "{\"@type\":\"gx:ByteBuffer\", \"@value\":\"c29tZSBieXRlcyBmb3IgeW91\"}";
- var reader = CreateStandardGraphSONReader(version);
-
- var jsonElement = JsonSerializer.Deserialize<JsonElement>(graphSon);
- var deserializedValue = reader.ToObject(jsonElement);
-
- Assert.Equal(Convert.FromBase64String("c29tZSBieXRlcyBmb3IgeW91"), deserializedValue);
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldDeserializeInt16(int version)
- {
- const string graphSon = "{\"@type\":\"gx:Int16\", \"@value\":100}";
- var reader = CreateStandardGraphSONReader(version);
-
- var jsonElement = JsonSerializer.Deserialize<JsonElement>(graphSon);
- var deserializedValue = reader.ToObject(jsonElement);
-
- Assert.Equal(100, deserializedValue);
- }
- }
-
- internal class TestGraphSONDeserializer : IGraphSONDeserializer
- {
- public dynamic Objectify(JsonElement graphsonObject, GraphSONReader reader)
- {
- return new TestClass {Value = graphsonObject.GetString()};
- }
- }
-}
\ No newline at end of file
diff --git a/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONWriterTests.cs b/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONWriterTests.cs
deleted file mode 100644
index a2c4d1b7ab..0000000000
--- a/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONWriterTests.cs
+++ /dev/null
@@ -1,641 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#endregion
-
-using System;
-using System.Collections.Generic;
-using System.Numerics;
-using System.Text.Json;
-using Gremlin.Net.Process.Traversal;
-using Gremlin.Net.Process.Traversal.Strategy.Decoration;
-using Gremlin.Net.Process.Traversal.Strategy.Optimization;
-using Gremlin.Net.Process.Traversal.Strategy.Verification;
-using Gremlin.Net.Structure;
-using Gremlin.Net.Structure.IO.GraphSON;
-using Xunit;
-
-namespace Gremlin.Net.UnitTest.Structure.IO.GraphSON
-{
- public class GraphSONWriterTests
- {
- /// <summary>
- /// Parameters for each test supporting multiple versions of GraphSON
- /// </summary>
- public static IEnumerable<object[]> Versions => new []
- {
- new object[] { 2 },
- new object[] { 3 }
- };
-
- /// <summary>
- /// Parameters for each collections test supporting multiple versions of GraphSON
- /// </summary>
- public static IEnumerable<object[]> VersionsSupportingCollections => new []
- {
- new object[] { 3 }
- };
-
- /// <summary>
- /// Parameters for each collections test supporting multiple versions of GraphSON
- /// </summary>
- public static IEnumerable<object[]> VersionsNotSupportingCollections => new []
- {
- new object[] { 2 }
- };
-
- private GraphSONWriter CreateGraphSONWriter(int version)
- {
- if (version == 3)
- {
- return new GraphSON3Writer();
- }
- return new GraphSON2Writer();
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldSerializeInt(int version)
- {
- var writer = CreateGraphSONWriter(version);
-
- var graphSon = writer.WriteObject(1);
-
- Assert.Equal("{\"@type\":\"g:Int32\",\"@value\":1}", graphSon);
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldSerializeLong(int version)
- {
- var writer = CreateGraphSONWriter(version);
-
- var graphSon = writer.WriteObject((long) 2);
-
- Assert.Equal("{\"@type\":\"g:Int64\",\"@value\":2}", graphSon);
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldSerializeFloat(int version)
- {
- var writer = CreateGraphSONWriter(version);
-
- var graphSon = writer.WriteObject((float) 3.2);
-
- Assert.Equal("{\"@type\":\"g:Float\",\"@value\":3.2}", graphSon);
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldSerializeDouble(int version)
- {
- var writer = CreateGraphSONWriter(version);
-
- var graphSon = writer.WriteObject(3.2);
-
- Assert.Equal("{\"@type\":\"g:Double\",\"@value\":3.2}", graphSon);
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldSerializeNaN(int version)
- {
- var writer = CreateGraphSONWriter(version);
-
- var graphSon = writer.WriteObject(Double.NaN);
-
- Assert.Equal("{\"@type\":\"g:Double\",\"@value\":\"NaN\"}", graphSon);
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldSerializePositiveInfinity(int version)
- {
- var writer = CreateGraphSONWriter(version);
-
- var graphSon = writer.WriteObject(Double.PositiveInfinity);
-
- Assert.Equal("{\"@type\":\"g:Double\",\"@value\":\"Infinity\"}", graphSon);
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldSerializeNegativeInfinity(int version)
- {
- var writer = CreateGraphSONWriter(version);
-
- var graphSon = writer.WriteObject(Double.NegativeInfinity);
-
- Assert.Equal("{\"@type\":\"g:Double\",\"@value\":\"-Infinity\"}", graphSon);
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldSerializeDecimal(int version)
- {
- var writer = CreateGraphSONWriter(version);
-
- var graphSon = writer.WriteObject(6.5M);
-
- Assert.Equal("{\"@type\":\"gx:BigDecimal\",\"@value\":\"6.5\"}", graphSon);
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldSerializeBoolean(int version)
- {
- var writer = CreateGraphSONWriter(version);
-
- var graphSon = writer.WriteObject(true);
-
- Assert.Equal("true", graphSon);
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldSerializeArray(int version)
- {
- var writer = CreateGraphSONWriter(version);
- var array = new[] {5, 6};
-
- var serializedGraphSON = writer.WriteObject(array);
-
- var expectedGraphSON = "[{\"@type\":\"g:Int32\",\"@value\":5},{\"@type\":\"g:Int32\",\"@value\":6}]";
- Assert.Equal(expectedGraphSON, serializedGraphSON);
- }
-
- [Fact]
- public void ShouldSerializeWithCustomSerializerForNewType()
- {
- var customSerializerByType = new Dictionary<Type, IGraphSONSerializer>
- {
- {typeof(TestClass), new TestGraphSONSerializer {TestNamespace = "NS"}}
- };
- var writer = new GraphSON2Writer(customSerializerByType);
- var testObj = new TestClass {Value = "test"};
-
- var serialized = writer.WriteObject(testObj);
-
- Assert.Equal("{\"@type\":\"NS:TestClass\",\"@value\":\"test\"}", serialized);
- }
-
- [Fact]
- public void ShouldSerializeWithCustomSerializerForCommonType()
- {
- var customSerializer = new CustomDummySerializer();
- var customSerializerByType = new Dictionary<Type, IGraphSONSerializer>
- {
- {typeof(int), customSerializer}
- };
- var writer = new GraphSON2Writer(customSerializerByType);
-
- writer.WriteObject(12);
-
- Assert.Equal(12, customSerializer.DictifiedLast);
- }
-
- private class CustomDummySerializer : IGraphSONSerializer
- {
- public dynamic DictifiedLast { get; private set; }
-
- public Dictionary<string, dynamic> Dictify(dynamic objectData, GraphSONWriter writer)
- {
- DictifiedLast = objectData;
- return new Dictionary<string, dynamic>();
- }
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldSerializeDateTimeOffset(int version)
- {
- var writer = CreateGraphSONWriter(version);
- var dateTimeOffset = TestUtils.FromJavaTime(1475583442552);
-
- var graphSon = writer.WriteObject(dateTimeOffset);
-
- const string expected = "{\"@type\":\"gx:OffsetDateTime\",\"@value\":\"2016-10-04T12:17:22.5520000+00:00\"}";
- Assert.Equal(expected, graphSon);
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldSerializeDictionary(int version)
- {
- var writer = CreateGraphSONWriter(version);
- var dictionary = new Dictionary<string, dynamic>
- {
- {"age", new List<int> {29}},
- {"name", new List<string> {"marko"}}
- };
-
- var serializedDict = writer.WriteObject(dictionary);
-
- var expectedGraphSON = "{\"age\":[{\"@type\":\"g:Int32\",\"@value\":29}],\"name\":[\"marko\"]}";
- Assert.Equal(expectedGraphSON, serializedDict);
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldSerializeEdge(int version)
- {
- var writer = CreateGraphSONWriter(version);
- var edge = new Edge(7, new Vertex(0, "person"), "knows", new Vertex(1, "dog"));
-
- var graphSON = writer.WriteObject(edge);
-
- const string expected =
- "{\"@type\":\"g:Edge\",\"@value\":{\"id\":{\"@type\":\"g:Int32\",\"@value\":7},\"outV\":{\"@type\":\"g:Int32\",\"@value\":0},\"outVLabel\":\"person\",\"label\":\"knows\",\"inV\":{\"@type\":\"g:Int32\",\"@value\":1},\"inVLabel\":\"dog\"}}";
- Assert.Equal(expected, graphSON);
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldSerializeDirection(int version)
- {
- var writer = CreateGraphSONWriter(version);
-
- var serializedEnum = writer.WriteObject(Direction.Both);
-
- var expectedGraphSON = "{\"@type\":\"g:Direction\",\"@value\":\"BOTH\"}";
- Assert.Equal(expectedGraphSON, serializedEnum);
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldSerializeDT(int version)
- {
- var writer = CreateGraphSONWriter(version);
-
- var serializedEnum = writer.WriteObject(DT.Minute);
-
- var expectedGraphSON = "{\"@type\":\"g:DT\",\"@value\":\"minute\"}";
- Assert.Equal(expectedGraphSON, serializedEnum);
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldSerializeMerge(int version)
- {
- var writer = CreateGraphSONWriter(version);
-
- var serializedEnum = writer.WriteObject(Merge.OnMatch);
-
- var expectedGraphSON = "{\"@type\":\"g:Merge\",\"@value\":\"onMatch\"}";
- Assert.Equal(expectedGraphSON, serializedEnum);
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldSerializeGType(int version)
- {
- var writer = CreateGraphSONWriter(version);
-
- var serializedEnum = writer.WriteObject(GType.Byte);
-
- var expectedGraphSON = "{\"@type\":\"g:GType\",\"@value\":\"BYTE\"}";
- Assert.Equal(expectedGraphSON, serializedEnum);
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldSerializeList(int version)
- {
- var writer = CreateGraphSONWriter(version);
- var list = new List<int> {5, 6};
-
- var serializedGraphSON = writer.WriteObject(list.ToArray());
-
- var expectedGraphSON = "[{\"@type\":\"g:Int32\",\"@value\":5},{\"@type\":\"g:Int32\",\"@value\":6}]";
- Assert.Equal(expectedGraphSON, serializedGraphSON);
- }
-
- [Theory, MemberData(nameof(VersionsSupportingCollections))]
- public void ShouldSerializeGList(int version)
- {
- var writer = CreateGraphSONWriter(version);
- var list = new List<object?> {5, 6, null};
-
- var serializedGraphSON = writer.WriteObject(list);
-
- var expectedGraphSON = "{\"@type\":\"g:List\",\"@value\":[{\"@type\":\"g:Int32\",\"@value\":5}," +
- "{\"@type\":\"g:Int32\",\"@value\":6},null]}";
- Assert.Equal(expectedGraphSON, serializedGraphSON);
- }
-
- [Theory, MemberData(nameof(VersionsSupportingCollections))]
- public void ShouldSerializeGSet(int version)
- {
- var writer = CreateGraphSONWriter(version);
- ISet<object> set = new HashSet<object> {600L, 700L};
-
- var serializedGraphSON = writer.WriteObject(set);
-
- var expectedGraphSON = "{\"@type\":\"g:Set\",\"@value\":[{\"@type\":\"g:Int64\",\"@value\":600}," +
- "{\"@type\":\"g:Int64\",\"@value\":700}]}";
- Assert.Equal(expectedGraphSON, serializedGraphSON);
- }
-
- [Theory, MemberData(nameof(VersionsSupportingCollections))]
- public void ShouldSerializeGMap(int version)
- {
- var writer = CreateGraphSONWriter(version);
- IDictionary<object, object> map = new Dictionary<object, object> { { 1L, "a"}, { 200L, "b"}};
-
- var serializedGraphSON = writer.WriteObject(map);
-
- var expectedGraphSON = "{\"@type\":\"g:Map\",\"@value\":[{\"@type\":\"g:Int64\",\"@value\":1},\"a\"," +
- "{\"@type\":\"g:Int64\",\"@value\":200},\"b\"]}";
- Assert.Equal(expectedGraphSON, serializedGraphSON);
- }
-
- [Theory, MemberData(nameof(VersionsNotSupportingCollections))]
- public void ShouldSerializePredicateWithMultipleValuesAsJSONArray(int version)
- {
- var writer = CreateGraphSONWriter(version);
- var predicate = new P("within", new List<int> {1, 2});
-
- var serializedPredicate = writer.WriteObject(predicate);
-
- var expectedGraphSON =
- "{\"@type\":\"g:P\",\"@value\":{\"predicate\":\"within\",\"value\":[{\"@type\":\"g:Int32\",\"@value\":1},{\"@type\":\"g:Int32\",\"@value\":2}]}}";
- Assert.Equal(expectedGraphSON, serializedPredicate);
-
- predicate = P.Within(1, 2);
-
- serializedPredicate = writer.WriteObject(predicate);
-
- Assert.Equal(expectedGraphSON, serializedPredicate);
- }
-
- [Theory, MemberData(nameof(VersionsSupportingCollections))]
- public void ShouldSerializePredicateWithMultipleValues(int version)
- {
- var writer = CreateGraphSONWriter(version);
- var predicate = P.Within(new List<int> {1, 2});
-
- var serializedPredicate = writer.WriteObject(predicate);
-
- var expectedGraphSON =
- "{\"@type\":\"g:P\",\"@value\":{\"predicate\":\"within\",\"value\":{\"@type\":\"g:List\",\"@value\":[{\"@type\":\"g:Int32\",\"@value\":1},{\"@type\":\"g:Int32\",\"@value\":2}]}}}";
- Assert.Equal(expectedGraphSON, serializedPredicate);
-
- predicate = P.Within(1, 2);
-
- serializedPredicate = writer.WriteObject(predicate);
-
- Assert.Equal(expectedGraphSON, serializedPredicate);
-
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldSerializePredicateWithSingleValue(int version)
- {
- var writer = CreateGraphSONWriter(version);
- var predicate = new P("lt", 5);
-
- var serializedPredicate = writer.WriteObject(predicate);
-
- var expectedGraphSON =
- "{\"@type\":\"g:P\",\"@value\":{\"predicate\":\"lt\",\"value\":{\"@type\":\"g:Int32\",\"@value\":5}}}";
- Assert.Equal(expectedGraphSON, serializedPredicate);
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldSerializePropertyWithEdgeElement(int version)
- {
- var writer = CreateGraphSONWriter(version);
- var property = new Property("aKey", "aValue", new Edge("anId", new Vertex(1), "edgeLabel", new Vertex(2)));
-
- var graphSON = writer.WriteObject(property);
-
- const string expected =
- "{\"@type\":\"g:Property\",\"@value\":{\"key\":\"aKey\",\"value\":\"aValue\",\"element\":{\"@type\":\"g:Edge\",\"@value\":{\"id\":\"anId\",\"outV\":{\"@type\":\"g:Int32\",\"@value\":1},\"label\":\"edgeLabel\",\"inV\":{\"@type\":\"g:Int32\",\"@value\":2}}}}}";
- Assert.Equal(expected, graphSON);
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldSerializePropertyWithVertexPropertyElement(int version)
- {
- var writer = CreateGraphSONWriter(version);
- var property = new Property("name", "marko",
- new VertexProperty("anId", "aKey", 21345, new Vertex("vertexId")));
-
- var graphSON = writer.WriteObject(property);
-
- const string expected =
- "{\"@type\":\"g:Property\",\"@value\":{\"key\":\"name\",\"value\":\"marko\",\"element\":{\"@type\":\"g:VertexProperty\",\"@value\":{\"id\":\"anId\",\"label\":\"aKey\",\"vertex\":\"vertexId\"}}}}";
- Assert.Equal(expected, graphSON);
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldSerializeVertexProperty(int version)
- {
- var writer = CreateGraphSONWriter(version);
- var vertexProperty = new VertexProperty("blah", "keyA", true, new Vertex("stephen"));
-
- var graphSON = writer.WriteObject(vertexProperty);
-
- const string expected =
- "{\"@type\":\"g:VertexProperty\",\"@value\":{\"id\":\"blah\",\"label\":\"keyA\",\"value\":true,\"vertex\":\"stephen\"}}";
- Assert.Equal(expected, graphSON);
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldSerializeGuid(int version)
- {
- var writer = CreateGraphSONWriter(version);
- var guid = Guid.Parse("41d2e28a-20a4-4ab0-b379-d810dede3786");
-
- var graphSon = writer.WriteObject(guid);
-
- const string expected = "{\"@type\":\"g:UUID\",\"@value\":\"41d2e28a-20a4-4ab0-b379-d810dede3786\"}";
- Assert.Equal(expected, graphSon);
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldSerializeVertex(int version)
- {
- var writer = CreateGraphSONWriter(version);
- var vertex = new Vertex(45.23f);
-
- var graphSON = writer.WriteObject(vertex);
-
- const string expected =
- "{\"@type\":\"g:Vertex\",\"@value\":{\"id\":{\"@type\":\"g:Float\",\"@value\":45.23},\"label\":\"vertex\"}}";
- Assert.Equal(expected, graphSON);
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldSerializeVertexWithLabel(int version)
- {
- var writer = CreateGraphSONWriter(version);
- var vertex = new Vertex((long) 123, "project");
-
- var graphSON = writer.WriteObject(vertex);
-
- const string expected =
- "{\"@type\":\"g:Vertex\",\"@value\":{\"id\":{\"@type\":\"g:Int64\",\"@value\":123},\"label\":\"project\"}}";
- Assert.Equal(expected, graphSON);
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldSerializeReadOnlyStrategy(int version)
- {
- var writer = CreateGraphSONWriter(version);
- var readonlyStrategy = new ReadOnlyStrategy();
-
- var graphSon = writer.WriteObject(readonlyStrategy);
-
- const string expected = "{\"@type\":\"g:ReadOnlyStrategy\",\"@value\":{\"fqcn\":\"org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReadOnlyStrategy\",\"conf\":{}}}";
- Assert.Equal(expected, graphSon);
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldSerializeSubgraphStrategyEmptyConfig(int version)
- {
- var writer = CreateGraphSONWriter(version);
- var readonlyStrategy = new SubgraphStrategy();
-
- var graphSon = writer.WriteObject(readonlyStrategy);
-
- const string expected = "{\"@type\":\"g:SubgraphStrategy\",\"@value\":{\"fqcn\":\"org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.SubgraphStrategy\",\"conf\":{}}}";
- Assert.Equal(expected, graphSon);
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldSerializeSubgraphStrategy(int version)
- {
- var writer = CreateGraphSONWriter(version);
- var readonlyStrategy = new SubgraphStrategy(vertices: __.HasLabel("person"));
-
- Assert.Throws<NotSupportedException>(() => writer.WriteObject(readonlyStrategy));
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldSerializeClass(int version)
- {
- var writer = CreateGraphSONWriter(version);
- var type = typeof(InlineFilterStrategy);
-
- var graphSon = writer.WriteObject(type);
-
- const string expected = "{\"@type\":\"g:Class\",\"@value\":\"org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.InlineFilterStrategy\"}";
- Assert.Equal(expected, graphSon);
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldSerializeLambda(int version)
- {
- var writer = CreateGraphSONWriter(version);
- var lambda = Lambda.Groovy("{ it.get() }");
-
- var graphSon = writer.WriteObject(lambda);
-
- const string expected =
- "{\"@type\":\"g:Lambda\",\"@value\":{\"script\":\"{ it.get() }\",\"language\":\"gremlin-groovy\",\"arguments\":-1}}";
- Assert.Equal(expected, graphSon);
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldSerializeTimeSpan(int version)
- {
- var writer = CreateGraphSONWriter(version);
- var timeSpan = new TimeSpan(5, 4, 3, 2, 1);
-
- var graphSon = writer.WriteObject(timeSpan);
-
- const string expected = "{\"@type\":\"gx:Duration\",\"@value\":\"P5DT4H3M2.001S\"}";
- Assert.Equal(expected, graphSon);
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldSerializeBigInteger(int version)
- {
- var writer = CreateGraphSONWriter(version);
- var bigInteger = BigInteger.Parse("123456789987654321123456789987654321");
-
- var graphSon = writer.WriteObject(bigInteger);
-
- const string expected = "{\"@type\":\"gx:BigInteger\",\"@value\":\"123456789987654321123456789987654321\"}";
- Assert.Equal(expected, graphSon);
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldSerializeByte(int version)
- {
- var writer = CreateGraphSONWriter(version);
-
- var graphSon = writer.WriteObject((sbyte)1);
-
- Assert.Equal("{\"@type\":\"gx:Byte\",\"@value\":1}", graphSon);
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldSerializeByteNegativeValue(int version)
- {
- var writer = CreateGraphSONWriter(version);
-
- var graphSon = writer.WriteObject((sbyte)-42);
-
- Assert.Equal("{\"@type\":\"gx:Byte\",\"@value\":-42}", graphSon);
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void TestSByteGraphSONFormat(int version)
- {
- var writer = CreateGraphSONWriter(version);
- var value = (sbyte)42;
-
- var serialized = writer.WriteObject(value);
- var jsonDoc = JsonDocument.Parse(serialized);
-
- Assert.True(jsonDoc.RootElement.TryGetProperty("@type", out var typeProperty));
- Assert.Equal("gx:Byte", typeProperty.GetString());
-
- Assert.True(jsonDoc.RootElement.TryGetProperty("@value", out var valueProperty));
- Assert.Equal(42, valueProperty.GetSByte());
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldSerializeByteBuffer(int version)
- {
- var writer = CreateGraphSONWriter(version);
-
- var graphSon = writer.WriteObject(Convert.FromBase64String("c29tZSBieXRlcyBmb3IgeW91"));
-
- Assert.Equal("{\"@type\":\"gx:ByteBuffer\",\"@value\":\"c29tZSBieXRlcyBmb3IgeW91\"}", graphSon);
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldSerializeChar(int version)
- {
- var writer = CreateGraphSONWriter(version);
-
- var graphSon = writer.WriteObject('x');
-
- Assert.Equal("{\"@type\":\"gx:Char\",\"@value\":\"x\"}", graphSon);
- }
-
- [Theory, MemberData(nameof(Versions))]
- public void ShouldSerializeInt16(int version)
- {
- var writer = CreateGraphSONWriter(version);
-
- var graphSon = writer.WriteObject((short)100);
-
- Assert.Equal("{\"@type\":\"gx:Int16\",\"@value\":100}", graphSon);
- }
- }
-
- internal class TestGraphSONSerializer : IGraphSONSerializer
- {
- public string? TestNamespace { get; set; }
-
- public Dictionary<string, dynamic> Dictify(dynamic objectData, GraphSONWriter writer)
- {
- return GraphSONUtil.ToTypedValue(nameof(TestClass), objectData.Value, TestNamespace);
- }
- }
-}
\ No newline at end of file
diff --git a/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/TestClass.cs b/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/TestClass.cs
deleted file mode 100644
index 9a9183a124..0000000000
--- a/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/TestClass.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#endregion
-
-namespace Gremlin.Net.UnitTest.Structure.IO.GraphSON
-{
- internal class TestClass
- {
- public dynamic? Value { get; set; }
- }
-}
\ No newline at end of file
diff --git a/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/TestUtils.cs b/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/TestUtils.cs
deleted file mode 100644
index b6fb39cb1e..0000000000
--- a/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/TestUtils.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-#region License
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#endregion
-
-using System;
-
-namespace Gremlin.Net.UnitTest.Structure.IO.GraphSON
-{
- internal static class TestUtils
- {
- public static DateTimeOffset FromJavaTime(long milliseconds)
- {
- var epoch = new DateTimeOffset(1970, 1, 1, 0, 0, 0, 0, TimeSpan.Zero);
- return epoch.AddTicks(TimeSpan.TicksPerMillisecond * milliseconds);
- }
- }
-}
\ No newline at end of file