diff --git a/compatibility/Types/Product.cs b/compatibility/Types/Product.cs
index 4a63bbd..e5ec4cc 100644
--- a/compatibility/Types/Product.cs
+++ b/compatibility/Types/Product.cs
@@ -43,7 +43,7 @@ public Product(string id, string? sku, string? package, ProductVariation? variat
public static Product? GetProductById(
string id,
Data repository)
- => repository.Products.FirstOrDefault(t => t.Id.Equals(id));
+ => repository.Products.FirstOrDefault(t => id.Equals(t.Id));
[ReferenceResolver]
public static Product? GetProductByPackage(
@@ -51,8 +51,7 @@ public Product(string id, string? sku, string? package, ProductVariation? variat
string package,
Data repository)
=> repository.Products.FirstOrDefault(
- t => (t.Sku?.Equals(sku) ?? false) &&
- (t.Package?.Equals(package) ?? false));
+ t => sku.Equals(t.Sku) && package.Equals(t.Package));
[ReferenceResolver]
public static Product? GetProductByVariation(
@@ -60,6 +59,6 @@ public Product(string id, string? sku, string? package, ProductVariation? variat
[Map("variation.id")] string variationId,
Data repository)
=> repository.Products.FirstOrDefault(
- t => (t.Sku?.Equals(sku) ?? false) &&
- (t.Variation?.Id.Equals(variationId) ?? false));
+ t => sku.Equals(t.Sku) && variationId.Equals(t.Variation?.Id)
+ );
}
diff --git a/compatibility/Types/ProductResearch.cs b/compatibility/Types/ProductResearch.cs
index 5947ae8..09a101f 100644
--- a/compatibility/Types/ProductResearch.cs
+++ b/compatibility/Types/ProductResearch.cs
@@ -20,7 +20,6 @@ public ProductResearch(CaseStudy study, string? outcome)
[Map("study.caseNumber")] string caseNumber,
Data repository)
{
- Console.WriteLine("case number = {0}", caseNumber);
return repository.ProductResearches.FirstOrDefault(
r => r.Study.CaseNumber.Equals(caseNumber));
}
diff --git a/src/Federation/Descriptors/EntityResolverDescriptor.cs b/src/Federation/Descriptors/EntityResolverDescriptor.cs
index d5dddca..e1065f2 100644
--- a/src/Federation/Descriptors/EntityResolverDescriptor.cs
+++ b/src/Federation/Descriptors/EntityResolverDescriptor.cs
@@ -65,29 +65,6 @@ private void OnCompleteDefinition(ObjectTypeDefinition definition)
protected override EntityResolverDefinition Definition { get; set; } = new();
- ///
- public IObjectTypeDescriptor ResolveReference(
- FieldResolverDelegate fieldResolver)
- => ResolveReference(fieldResolver, Array.Empty());
-
- private IObjectTypeDescriptor ResolveReference(
- FieldResolverDelegate fieldResolver,
- IReadOnlyList required)
- {
- if (fieldResolver is null)
- {
- throw new ArgumentNullException(nameof(fieldResolver));
- }
-
- if (required is null)
- {
- throw new ArgumentNullException(nameof(required));
- }
-
- Definition.ResolverDefinition = new(fieldResolver, required);
- return _typeDescriptor;
- }
-
///
public IObjectTypeDescriptor ResolveReferenceWith(
Expression> method)
@@ -114,13 +91,6 @@ public IObjectTypeDescriptor ResolveReferenceWith(
nameof(member));
}
- ///
- public IObjectTypeDescriptor ResolveReferenceWith()
- => ResolveReferenceWith(
- Context.TypeInspector.GetNodeResolverMethod(
- Definition.EntityType ?? typeof(TResolver),
- typeof(TResolver))!);
-
///
public IObjectTypeDescriptor ResolveReferenceWith(MethodInfo method)
{
@@ -141,10 +111,21 @@ public IObjectTypeDescriptor ResolveReferenceWith(MethodInfo method)
return ResolveReference(resolver.Resolver!, argumentBuilder.Required);
}
- ///
- public IObjectTypeDescriptor ResolveReferenceWith(Type type)
- => ResolveReferenceWith(
- Context.TypeInspector.GetNodeResolverMethod(
- Definition.EntityType ?? type,
- type)!);
+ private IObjectTypeDescriptor ResolveReference(
+ FieldResolverDelegate fieldResolver,
+ IReadOnlyList required)
+ {
+ if (fieldResolver is null)
+ {
+ throw new ArgumentNullException(nameof(fieldResolver));
+ }
+
+ if (required is null)
+ {
+ throw new ArgumentNullException(nameof(required));
+ }
+
+ Definition.ResolverDefinition = new(fieldResolver, required);
+ return _typeDescriptor;
+ }
}
diff --git a/src/Federation/Descriptors/IEntityResolverDescriptor.cs b/src/Federation/Descriptors/IEntityResolverDescriptor.cs
index 2e6758a..12b4224 100644
--- a/src/Federation/Descriptors/IEntityResolverDescriptor.cs
+++ b/src/Federation/Descriptors/IEntityResolverDescriptor.cs
@@ -9,44 +9,6 @@ namespace ApolloGraphQL.HotChocolate.Federation.Descriptors;
///
public interface IEntityResolverDescriptor
{
- ///
- /// Resolve an entity from its representation.
- ///
- ///
- /// The resolver.
- ///
- ///
- /// Returns the descriptor for configuration chaining.
- ///
- IObjectTypeDescriptor ResolveReference(
- FieldResolverDelegate fieldResolver);
-
- ///
- /// Resolve an entity from its representation.
- ///
- ///
- /// The reference resolver selector.
- ///
- ///
- /// The type on which the reference resolver is located.
- ///
- ///
- /// Returns the descriptor for configuration chaining.
- ///
- IObjectTypeDescriptor ResolveReferenceWith(
- Expression> method);
-
- ///
- /// Resolve an entity from its representation.
- ///
- ///
- /// The type on which the reference resolver is located.
- ///
- ///
- /// Returns the descriptor for configuration chaining.
- ///
- IObjectTypeDescriptor ResolveReferenceWith();
-
///
/// Resolve an entity from its representation.
///
@@ -57,17 +19,6 @@ IObjectTypeDescriptor ResolveReferenceWith(
/// Returns the descriptor for configuration chaining.
///
IObjectTypeDescriptor ResolveReferenceWith(MethodInfo method);
-
- ///
- /// Resolve an entity from its representation.
- ///
- ///
- /// The type on which the reference resolver is located.
- ///
- ///
- /// Returns the descriptor for configuration chaining.
- ///
- IObjectTypeDescriptor ResolveReferenceWith(Type type);
}
///
@@ -75,18 +26,6 @@ IObjectTypeDescriptor ResolveReferenceWith(
///
public interface IEntityResolverDescriptor
{
- ///
- /// Resolve an entity from its representation.
- ///
- ///
- /// The resolver.
- ///
- ///
- /// Returns the descriptor for configuration chaining.
- ///
- IObjectTypeDescriptor ResolveReference(
- FieldResolverDelegate fieldResolver);
-
///
/// Resolve an entity from its representation.
///
@@ -99,32 +38,6 @@ IObjectTypeDescriptor ResolveReference(
IObjectTypeDescriptor ResolveReferenceWith(
Expression> method);
- ///
- /// Resolve an entity from its representation.
- ///
- ///
- /// The reference resolver selector.
- ///
- ///
- /// The type on which the reference resolver is located.
- ///
- ///
- /// Returns the descriptor for configuration chaining.
- ///
- IObjectTypeDescriptor ResolveReferenceWith(
- Expression> method);
-
- ///
- /// Resolve an entity from its representation.
- ///
- ///
- /// The type on which the reference resolver is located.
- ///
- ///
- /// Returns the descriptor for configuration chaining.
- ///
- IObjectTypeDescriptor ResolveReferenceWith();
-
///
/// Resolve an entity from its representation.
///
@@ -135,15 +48,4 @@ IObjectTypeDescriptor ResolveReferenceWith(
/// Returns the descriptor for configuration chaining.
///
IObjectTypeDescriptor ResolveReferenceWith(MethodInfo method);
-
- ///
- /// Resolve an entity from its representation.
- ///
- ///
- /// The type on which the reference resolver is located.
- ///
- ///
- /// Returns the descriptor for configuration chaining.
- ///
- IObjectTypeDescriptor ResolveReferenceWith(Type type);
}
diff --git a/src/Federation/Helpers/ArgumentParser.cs b/src/Federation/Helpers/ArgumentParser.cs
index 2016895..d832833 100644
--- a/src/Federation/Helpers/ArgumentParser.cs
+++ b/src/Federation/Helpers/ArgumentParser.cs
@@ -31,10 +31,15 @@ private static bool TryGetValue(
int i,
out T? value)
{
+ // TODO does not support list
switch (valueNode.Kind)
{
case SyntaxKind.ObjectValue:
var current = path[i];
+ if (type.IsNonNullType())
+ {
+ return TryGetValue(valueNode, type.InnerType(), path, i, out value);
+ }
if (type is not IComplexOutputType complexType ||
!complexType.Fields.TryGetField(current, out var field))
@@ -55,11 +60,9 @@ private static bool TryGetValue(
}
}
break;
-
case SyntaxKind.NullValue:
value = default(T);
return true;
-
case SyntaxKind.StringValue:
case SyntaxKind.IntValue:
case SyntaxKind.FloatValue:
@@ -115,6 +118,7 @@ private static bool Matches(IValueNode valueNode, string[] path, int i)
{
switch (valueNode.Kind)
{
+ // TODO does not handle list
case SyntaxKind.ObjectValue:
var current = path[i];