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

Allow node resolvers to be inferred from quer fields. #5350

Merged
merged 21 commits into from
Aug 29, 2022
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
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();
michaelstaib marked this conversation as resolved.
Show resolved Hide resolved

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