Skip to content

Commit

Permalink
Allow node resolvers to be inferred from quer fields. (#5350)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelstaib authored Aug 29, 2022
1 parent e2ab45b commit ef1b268
Show file tree
Hide file tree
Showing 89 changed files with 2,637 additions and 1,284 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -321,4 +321,5 @@ conferences.db
conferences.db-shm
conferences.db-wal

.server/
.server/
.nuke/
223 changes: 0 additions & 223 deletions .nuke/build.schema.json

This file was deleted.

2 changes: 1 addition & 1 deletion src/.vscode/settings.json → .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
"**/*.code-search": true,
"**/PublicAPI*.txt": true
},
"editor.rulers": [100]
"editor.rulers": [100],
}
2 changes: 1 addition & 1 deletion src/.vscode/tasks.json → .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"type": "shell",
"args": [
"build",
"All.sln",
"src/All.sln",
// Ask dotnet build to generate full paths for file names.
"/property:GenerateFullPaths=true",
// Do not generate summary otherwise it leads to duplicate errors in Problems panel
Expand Down
27 changes: 0 additions & 27 deletions src/HotChocolate/.vscode/launch.json

This file was deleted.

42 changes: 0 additions & 42 deletions src/HotChocolate/.vscode/tasks.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,14 @@ internal static class EntitiesResolver
objectType.ContextData.TryGetValue(EntityResolver, out var value) &&
value is FieldResolverDelegate resolver)
{
context.SetLocalState(TypeField, objectType);
context.SetLocalState(DataField, current.Data);
// We clone the resolver context here so that we can split the work
// into sub tasks that can be awaited in parallel and produce separate results.
var entityContext = context.Clone();

tasks[i] = resolver.Invoke(new ResolverContextProxy(context)).AsTask();
entityContext.SetLocalState(TypeField, objectType);
entityContext.SetLocalState(DataField, current.Data);

tasks[i] = resolver.Invoke(entityContext).AsTask();
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,7 @@ public async void TestResolveViaEntityResolver()
};

// assert
var result =
await EntitiesResolver.ResolveAsync(schema, representations, context);
var result = await EntitiesResolver.ResolveAsync(schema, representations, context);
var obj = Assert.IsType<TypeWithReferenceResolver>(result[0]);
Assert.Equal("1", obj.Id);
Assert.Equal("SomeField", obj.SomeField);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public static IResolverContext CreateResolverContext(
mock.SetupGet(c => c.ContextData).Returns(contextData);
mock.SetupProperty(c => c.ScopedContextData);
mock.SetupProperty(c => c.LocalContextData);
mock.Setup(c => c.Clone()).Returns(mock.Object);
mock.SetupGet(c => c.Schema).Returns(schema);

if (type is not null)
Expand Down
30 changes: 0 additions & 30 deletions src/HotChocolate/Core/.vscode/launch.json

This file was deleted.

1 change: 0 additions & 1 deletion src/HotChocolate/Core/.vscode/settings.json

This file was deleted.

Loading

0 comments on commit ef1b268

Please sign in to comment.