@@ -239,18 +239,14 @@ The `@deprecated` directive is a built in type system directive provided by grap
239239``` csharp
240240public sealed class DeprecatedDirective : GraphDirective
241241{
242- [DirectiveLocations (DirectiveLocation .FIELD_DEFINITION | DirectiveLocation .ENUM_VALUE )]
243- public IGraphActionResult Execute ([FromGraphQL (" reason" )] string reason = " No longer supported" )
244- {
245- if (this .DirectiveTarget is IGraphField field )
246- {
247- field .IsDeprecated = true ;
248- field .DeprecationReason = reason ;
249- }
250- else if (this .DirectiveTarget is IEnumValue enumValue )
242+ // additional validation checks and locations are excluded for brevity
243+ [DirectiveLocations (DirectiveLocation .FIELD_DEFINITION )]
244+ public IGraphActionResult Execute ([FromGraphQL (" reason" , TypeExpression = " Type!" )] string reason )
245+ {
246+ if (this .DirectiveTarget is IDeprecatable deprecatable )
251247 {
252- enumValue .IsDeprecated = true ;
253- enumValue .DeprecationReason = reason ;
248+ deprecatable .IsDeprecated = true ;
249+ deprecatable .DeprecationReason = reason ;
254250 }
255251
256252 return this .Ok ();
@@ -260,9 +256,14 @@ public sealed class DeprecatedDirective : GraphDirective
260256
261257This Directive:
262258
263- - Targets a FIELD_DEFINITION or ENUM_VALUE.
264- - Marks the field or enum value as deprecated and attaches the provided deprecation reason
265- - The directive is executed once per field definition and enum value its applied to when the schema is created.
259+ - Marks a field, input field, enum value or argument as deprecated and attaches the provided deprecation reason
260+ - Requires that a reason for deprecation be supplied
261+ - The directive is executed once per definition its applied to when the schema is created.
262+
263+
264+ ::: info
265+ Deprecation reason became a required value with the Sept. '25 specification update. (Library version v1.5)
266+ :::
266267
267268### Custom Example: @toLower
268269
0 commit comments