Skip to content

Commit

Permalink
Added simple by name bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelstaib committed Nov 15, 2023
1 parent d525eeb commit 609462f
Show file tree
Hide file tree
Showing 4 changed files with 528 additions and 195 deletions.
22 changes: 22 additions & 0 deletions src/HotChocolate/Fusion/src/Composition/Directives/IsDirective.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,29 @@ internal sealed class IsDirective : IEquatable<IsDirective>
/// </param>
public IsDirective(SchemaCoordinate coordinate)
{
ArgumentException.ThrowIfNullOrEmpty(coordinate.Name, nameof(coordinate));
Coordinate = coordinate;
}

/// <summary>
/// Creates a new instance of <see cref="IsDirective"/> that a field syntax to refer to field.
/// </summary>
/// <param name="field">
/// The field selection syntax that refers to another field.
/// </param>
public IsDirective(string field)
{
ArgumentException.ThrowIfNullOrEmpty(field);

Field = new FieldNode(
null,
new NameNode(field),
null,
null,
Array.Empty<DirectiveNode>(),
Array.Empty<ArgumentNode>(),
null);
}

/// <summary>
/// Creates a new instance of <see cref="IsDirective"/> that a field syntax to refer to field.
Expand All @@ -35,6 +56,7 @@ public IsDirective(SchemaCoordinate coordinate)
/// </param>
public IsDirective(FieldNode field)
{
ArgumentNullException.ThrowIfNull(field);
Field = field;
}

Expand Down
Loading

0 comments on commit 609462f

Please sign in to comment.