Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The graph-model on the default environment should be invalid. #936

Merged
merged 1 commit into from
May 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Core/Environment/GremlinQueryEnvironment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ public bool TryConvert(TSource source, ITransformer recurse, out TimeSpan value)
NullLogger.Instance);

public static readonly IGremlinQueryEnvironment Default = Empty
.UseModel(GraphModel.Invalid)
.UseSerializer(Serializer.Default)
.UseExecutor(GremlinQueryExecutor.Invalid)
.UseDeserializer(Deserializer.Default);
Expand Down
16 changes: 8 additions & 8 deletions test/Support.NewtonsoftJson.Tests/TansformerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,35 +135,35 @@ public Task Transform_to_List()
{
var token = JObject.Parse("{ \"@type\": \"g:List\", \"@value\": [ { \"@type\": \"g:Traverser\", \"@value\": { \"bulk\": { \"@type\": \"g:Int64\", \"@value\": 3 }, \"value\": { \"@type\": \"g:Map\", \"@value\": [ \"id\", { \"@type\": \"g:Int64\", \"@value\": 184 }, \"label\", \"Label\", \"properties\", { \"@type\": \"g:Map\", \"@value\": [] } ] } } } ]}");

return Verify(GremlinQueryEnvironment.Default
return Verify(GremlinQueryEnvironment.Empty
.UseNewtonsoftJson()
.Deserializer
.TransformTo<List<object>>()
.From(token, GremlinQueryEnvironment.Default));
.From(token, GremlinQueryEnvironment.Empty));
}

[Fact]
public Task Transform_to_array()
{
var token = JObject.Parse("{ \"@type\": \"g:List\", \"@value\": [ { \"@type\": \"g:Traverser\", \"@value\": { \"bulk\": { \"@type\": \"g:Int64\", \"@value\": 3 }, \"value\": { \"@type\": \"g:Map\", \"@value\": [ \"id\", { \"@type\": \"g:Int64\", \"@value\": 184 }, \"label\", \"Label\", \"properties\", { \"@type\": \"g:Map\", \"@value\": [] } ] } } } ]}");

return Verify(GremlinQueryEnvironment.Default
return Verify(GremlinQueryEnvironment.Empty
.UseNewtonsoftJson()
.Deserializer
.TransformTo<object[]>()
.From(token, GremlinQueryEnvironment.Default));
.From(token, GremlinQueryEnvironment.Empty));
}

[Fact]
public Task Transform_to_IEnumerable()
{
var token = JObject.Parse("{ \"@type\": \"g:List\", \"@value\": [ { \"@type\": \"g:Traverser\", \"@value\": { \"bulk\": { \"@type\": \"g:Int64\", \"@value\": 3 }, \"value\": { \"@type\": \"g:Map\", \"@value\": [ \"id\", { \"@type\": \"g:Int64\", \"@value\": 184 }, \"label\", \"Label\", \"properties\", { \"@type\": \"g:Map\", \"@value\": [] } ] } } } ]}");

var result = GremlinQueryEnvironment.Default
var result = GremlinQueryEnvironment.Empty
.UseNewtonsoftJson()
.Deserializer
.TransformTo<IEnumerable<object>>()
.From(token, GremlinQueryEnvironment.Default);
.From(token, GremlinQueryEnvironment.Empty);

return Verify(result);
}
Expand All @@ -173,11 +173,11 @@ public Task Transform_from_JArray_to_object()
{
var token = JObject.Parse("{ \"@type\": \"g:List\", \"@value\": [ { \"@type\": \"g:Traverser\", \"@value\": { \"bulk\": { \"@type\": \"g:Int64\", \"@value\": 3 }, \"value\": { \"@type\": \"g:Map\", \"@value\": [ \"id\", { \"@type\": \"g:Int64\", \"@value\": 184 }, \"label\", \"Label\", \"properties\", { \"@type\": \"g:Map\", \"@value\": [] } ] } } } ]}");

return Verify(GremlinQueryEnvironment.Default
return Verify(GremlinQueryEnvironment.Empty
.UseNewtonsoftJson()
.Deserializer
.TransformTo<object>()
.From(token, GremlinQueryEnvironment.Default));
.From(token, GremlinQueryEnvironment.Empty));
}
}
}
Loading