diff --git a/src/HotChocolate/AspNetCore/test/AspNetCore.Tests.Utilities/QueryExtension.cs b/src/HotChocolate/AspNetCore/test/AspNetCore.Tests.Utilities/QueryExtension.cs index 7bec5d5458e..fad6e69ce29 100644 --- a/src/HotChocolate/AspNetCore/test/AspNetCore.Tests.Utilities/QueryExtension.cs +++ b/src/HotChocolate/AspNetCore/test/AspNetCore.Tests.Utilities/QueryExtension.cs @@ -21,4 +21,10 @@ public async Task 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"; } diff --git a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/FieldDefinitionBase.cs b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/FieldDefinitionBase.cs index 32367bed04c..4cdba236f49 100644 --- a/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/FieldDefinitionBase.cs +++ b/src/HotChocolate/Core/src/Types/Types/Descriptors/Definitions/FieldDefinitionBase.cs @@ -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) @@ -127,5 +132,10 @@ protected void MergeInto(FieldDefinitionBase target) } target.Ignore = Ignore; + + if (IsDeprecated) + { + target.DeprecationReason = DeprecationReason; + } } } diff --git a/src/HotChocolate/Utilities/src/Utilities.Introspection/IntrospectionOptions.cs b/src/HotChocolate/Utilities/src/Utilities.Introspection/IntrospectionOptions.cs index 6ae6bf66f03..97b7b0761f7 100644 --- a/src/HotChocolate/Utilities/src/Utilities.Introspection/IntrospectionOptions.cs +++ b/src/HotChocolate/Utilities/src/Utilities.Introspection/IntrospectionOptions.cs @@ -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); @@ -69,4 +69,4 @@ public override int GetHashCode() public static bool operator !=(IntrospectionOptions left, IntrospectionOptions right) => !(left == right); -} \ No newline at end of file +} diff --git a/src/HotChocolate/Utilities/test/Utilities.Introspection.Tests/__snapshots__/IntrospectionClientTests.IntrospectServer_NET6.snap b/src/HotChocolate/Utilities/test/Utilities.Introspection.Tests/__snapshots__/IntrospectionClientTests.IntrospectServer_NET6.snap index 38b3ff659bc..b2dcf2f0f13 100644 --- a/src/HotChocolate/Utilities/test/Utilities.Introspection.Tests/__snapshots__/IntrospectionClientTests.IntrospectServer_NET6.snap +++ b/src/HotChocolate/Utilities/test/Utilities.Introspection.Tests/__snapshots__/IntrospectionClientTests.IntrospectServer_NET6.snap @@ -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 {