[
https://issues.apache.org/jira/browse/TINKERPOP-1696?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16494809#comment-16494809
]
ASF GitHub Bot commented on TINKERPOP-1696:
-------------------------------------------
Github user jorgebay commented on a diff in the pull request:
https://github.com/apache/tinkerpop/pull/868#discussion_r191665300
--- Diff: gremlin-dotnet/src/Gremlin.Net/Driver/Connection.cs ---
@@ -114,11 +116,18 @@ internal class Connection : IConnection
result.Add(d);
}
}
+
+ if (status.Code == ResponseStatusCode.Success ||
status.Code == ResponseStatusCode.NoContent)
+ {
+ statusAttributes = receivedMsg.Status.Attributes;
--- End diff --
Anything we expose should be agnostic to the serialization format. Status
attributes should not be dependent on how GraphSON3 composes the response.
In this case, we are exposing a dictionary containing `@type` and `@value`,
where `@value` is a `JArray` (a third party type).
Furthermore, we should hide any third party types from our API, see
TINKERPOP-1696 for example.
> gremlin-dotnet: GraphSONReader third-party type exposed
> -------------------------------------------------------
>
> Key: TINKERPOP-1696
> URL: https://issues.apache.org/jira/browse/TINKERPOP-1696
> Project: TinkerPop
> Issue Type: Improvement
> Components: dotnet
> Affects Versions: 3.3.0
> Reporter: Jorge Bay
> Priority: Minor
> Labels: breaking
>
> On gremlin-dotnet, the {{GraphSONReader}} public class and
> {{IGraphSONDeserializer}} public interface uses {{JToken}} as a parameter,
> which is a type defined in the third-party library Newtonsoft's Json.NET.
> {code:java}
> public class GraphSONReader {
> public dynamic ToObject(JToken jToken) {
> // ... implementation
> }
> }
> {code}
> {code:java}
> public interface IGraphSONDeserializer {
> object Objectify(JToken graphsonObject, GraphSONReader reader);
> }
> {code}
> Even though Json.NET is a well-known library, exposing a third-party library
> type is usually not a good idea as it tightly couples both libraries, ie:
> {{IGraphSONDeserializer}} implementers will have to use Json.NET.
> As we are dealing with JSON data, there is a benefit in parsing once and
> access the parsed data, like its currently implemented (we should avoid using
> strings and parse multiple times).
> I propose using
> [{{dynamic}}|https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/types/using-type-dynamic]
> instead. In C#, an object of type {{dynamic}} is basically a dictionary
> without compile time checks, which is suitable for scenarios like this one.
> {code:java}
> public class GraphSONReader {
> public dynamic ToObject(dynamic parsedJson) {
> // ... implementation
> string type = parsedJson["@type"];
> // ... get the deserializer for the given type ...
> }
> }
> {code}
> {code:java}
> public interface IGraphSONDeserializer {
> object Objectify(dynamic graphsonObject, GraphSONReader reader);
> }
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)