Skip to content

Commit

Permalink
Fixed Issue with Field Deprecations on Type Extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelstaib committed Jul 15, 2024
1 parent 0f8aef6 commit 06bcb6a
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,10 @@ public async Task<bool> Wait(int m, CancellationToken ct)
await Task.Delay(m, ct);
return true;
}

[GraphQLDeprecated("use something else")]
public string SomeDeprecatedField(
[GraphQLDeprecated("use something else")]
string deprecatedArg = "foo")
=> "foo";
}
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@ protected void CopyTo(FieldDefinitionBase target)

target.Type = Type;
target.Ignore = Ignore;

if (IsDeprecated)
{
target.DeprecationReason = DeprecationReason;
}
}

protected void MergeInto(FieldDefinitionBase target)
Expand All @@ -127,5 +132,10 @@ protected void MergeInto(FieldDefinitionBase target)
}

target.Ignore = Ignore;

if (IsDeprecated)
{
target.DeprecationReason = DeprecationReason;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,21 @@ public int TypeDepth
if (value < 3)
{
throw new ArgumentOutOfRangeException(
nameof(TypeDepth),
value,
nameof(TypeDepth),
value,
IntrospectionOptions_MinTypeDepth);
}
}

_typeDepth = value;
}
}

public bool Equals(IntrospectionOptions other)
=> Equals(_method, other._method) &&
Equals(_typeDepth, other._typeDepth) &&
Equals(Uri, other.Uri) &&
ReferenceEquals(OnMessageCreated, other.OnMessageCreated);
=> Equals(_method, other._method)
&& Equals(_typeDepth, other._typeDepth)
&& Equals(Uri, other.Uri)
&& ReferenceEquals(OnMessageCreated, other.OnMessageCreated);

public override bool Equals(object? obj)
=> obj is IntrospectionOptions options && Equals(options);

Expand All @@ -69,4 +69,4 @@ public override int GetHashCode()

public static bool operator !=(IntrospectionOptions left, IntrospectionOptions right)
=> !(left == right);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ type Query {
time: Long!
evict: Boolean!
wait(m: Int!): Boolean!
someDeprecatedField(deprecatedArg: String! = "foo" @deprecated(reason: "use something else")): String! @deprecated(reason: "use something else")
}

type Mutation {
Expand Down

0 comments on commit 06bcb6a

Please sign in to comment.