Repository navigation
Fix deprecation semantics to align with the GraphQL spec - #10193
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates HotChocolate’s deprecation handling to align with GraphQL spec semantics by treating “deprecated” as the presence of a (non-empty) deprecation reason, and by standardizing the default @deprecated reason across parsing/serialization/runtime types.
Changes:
- Standardize default
@deprecatedreason viaDirectiveNames.Deprecated.Arguments.DefaultReasonand treat empty/whitespace reasons as “not provided”. - Refactor multiple type-system models (Core, Mutable, Fusion, Data) so
IsDeprecatedis derived fromDeprecationReasonrather than a separate flag. - Add/adjust tests around SDL parsing/printing and deprecation reason normalization.
Reviewed changes
Copilot reviewed 53 out of 53 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/HotChocolate/Utilities/src/Utilities.Introspection/IntrospectionFormatter.cs | Use shared default reason and whitespace handling for synthesized @deprecated. |
| src/HotChocolate/Primitives/src/Primitives/Types/DirectiveNames.cs | Change default @deprecated reason constant. |
| src/HotChocolate/Mutable/test/Types.Mutable.Tests/SchemaParserTests.cs | Add parser tests for default deprecation reason and schema printing. |
| src/HotChocolate/Mutable/test/Types.Mutable.Tests/MutableOutputFieldDefinitionTests.cs | New tests for mutable output-field deprecation semantics. |
| src/HotChocolate/Mutable/test/Types.Mutable.Tests/MutableObjectTypeDefinitionTests.cs | Update tests to match new deprecation semantics and whitespace clearing. |
| src/HotChocolate/Mutable/test/Types.Mutable.Tests/MutableInputFieldDefinitionTests.cs | New tests for mutable input-field deprecation semantics. |
| src/HotChocolate/Mutable/test/Types.Mutable.Tests/MutableEnumValueTests.cs | New tests for mutable enum-value deprecation semantics. |
| src/HotChocolate/Mutable/test/Types.Mutable.Tests/MutableDirectiveDefinitionTests.cs | Update tests to match new deprecation semantics and whitespace clearing. |
| src/HotChocolate/Mutable/src/Types.Mutable/Serialization/SchemaParser.cs | Normalize deprecated directive parsing and always supply a default reason when missing/blank. |
| src/HotChocolate/Mutable/src/Types.Mutable/MutableOutputFieldDefinition.cs | Derive IsDeprecated from DeprecationReason; treat whitespace as null. |
| src/HotChocolate/Mutable/src/Types.Mutable/MutableObjectTypeDefinition.cs | Derive IsDeprecated from DeprecationReason; treat whitespace as null. |
| src/HotChocolate/Mutable/src/Types.Mutable/MutableInputFieldDefinition.cs | Derive IsDeprecated from DeprecationReason; treat whitespace as null. |
| src/HotChocolate/Mutable/src/Types.Mutable/MutableEnumValue.cs | Derive IsDeprecated from DeprecationReason; treat whitespace as null. |
| src/HotChocolate/Mutable/src/Types.Mutable/MutableDirectiveDefinition.cs | Derive IsDeprecated from DeprecationReason; treat whitespace as null. |
| src/HotChocolate/Mutable/src/Types.Mutable/Contracts/IMutableFieldDefinition.cs | Remove mutable IsDeprecated setter; document deprecation via DeprecationReason. |
| src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Execution/Types/FusionSchemaDefinitionDeprecationTests.cs | New tests for Fusion schema deprecation defaulting behavior. |
| src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Execution/Types/FusionEnumValueCollectionTests.cs | Update test helpers for changed constructor signature. |
| src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Execution/Types/FusionDirectiveCollectionTests.cs | Update test helpers for changed constructor signature. |
| src/HotChocolate/Fusion/src/Fusion.Execution.Types/FusionOutputFieldDefinition.cs | Derive deprecated flag from normalized DeprecationReason; remove explicit isDeprecated input. |
| src/HotChocolate/Fusion/src/Fusion.Execution.Types/FusionObjectTypeDefinition.cs | Derive IsDeprecated from normalized DeprecationReason; remove explicit isDeprecated input. |
| src/HotChocolate/Fusion/src/Fusion.Execution.Types/FusionInputFieldDefinition.cs | Derive IsDeprecated from normalized DeprecationReason; remove explicit isDeprecated input. |
| src/HotChocolate/Fusion/src/Fusion.Execution.Types/FusionEnumValue.cs | Derive IsDeprecated from normalized DeprecationReason; remove explicit isDeprecated input. |
| src/HotChocolate/Fusion/src/Fusion.Execution.Types/FusionDirectiveDefinition.cs | Derive IsDeprecated from normalized DeprecationReason; adjust obsolete ctor guidance. |
| src/HotChocolate/Fusion/src/Fusion.Execution.Types/Directives/DeprecatedDirectiveParser.cs | Parse deprecated reason with validation/defaulting; simplify API to return reason directly. |
| src/HotChocolate/Fusion/src/Fusion.Execution.Types/Completion/CompositeSchemaContext.cs | Update directive creation calls for removed isDeprecated parameters. |
| src/HotChocolate/Fusion/src/Fusion.Execution.Types/Completion/CompositeSchemaBuilder.cs | Use parsed deprecation reason instead of separate boolean + object. |
| src/HotChocolate/Fusion/src/Fusion.Composition/SourceSchemaMerger.cs | Merge deprecation by propagating first non-null reason (new semantics). |
| src/HotChocolate/Fusion/benchmarks/Fusion.Execution.Benchmarks/EnumScalarRowReuseBenchmark.cs | Update benchmark constructors for new deprecation API. |
| src/HotChocolate/Data/src/Data/Sorting/Fields/SortEnumValue.cs | Normalize deprecation via DeprecationReason only. |
| src/HotChocolate/Core/test/Types.Tests/Types/Descriptors/ObjectTypeDescriptorTests.cs | Expand theory coverage for whitespace deprecation reasons. |
| src/HotChocolate/Core/test/Types.Abstractions.Tests/Serialization/SchemaDebugFormatterTests.cs | Remove test relying on deprecated-with-null-reason state. |
| src/HotChocolate/Core/src/Types/Types/ObjectType.Initialization.cs | Normalize deprecation config (whitespace -> null) and derive IsDeprecated. |
| src/HotChocolate/Core/src/Types/Types/ObjectType.cs | Derive IsDeprecated from DeprecationReason. |
| src/HotChocolate/Core/src/Types/Types/FieldBase.cs | Normalize deprecation config (whitespace -> null) and derive IsDeprecated. |
| src/HotChocolate/Core/src/Types/Types/Factories/SdlToTypeSystemHelper.cs | Treat whitespace deprecation reasons as “missing”. |
| src/HotChocolate/Core/src/Types/Types/DirectiveType.Initialization.cs | Normalize deprecation config (whitespace -> null) and derive IsDeprecated. |
| src/HotChocolate/Core/src/Types/Types/DirectiveType.cs | Derive IsDeprecated from DeprecationReason. |
| src/HotChocolate/Core/src/Types/Types/Descriptors/OutputFieldDescriptorBase.cs | Treat whitespace deprecation reason as “no reason provided”. |
| src/HotChocolate/Core/src/Types/Types/Descriptors/ObjectTypeDescriptor.cs | Default whitespace deprecation reason to directive default. |
| src/HotChocolate/Core/src/Types/Types/Descriptors/EnumValueDescriptor.cs | Treat whitespace deprecation reason as “no reason provided”. |
| src/HotChocolate/Core/src/Types/Types/Descriptors/DirectiveTypeDescriptor.cs | Treat whitespace deprecation reason as “no reason provided”. |
| src/HotChocolate/Core/src/Types/Types/Descriptors/Configurations/FieldConfiguration.cs | Treat whitespace deprecation reason as clearing deprecation flag. |
| src/HotChocolate/Core/src/Types/Types/Descriptors/Configurations/EnumValueConfiguration.cs | Compute IsDeprecated from non-whitespace reason. |
| src/HotChocolate/Core/src/Types/Types/Descriptors/Configurations/DirectiveTypeConfiguration.cs | Compute IsDeprecated from non-whitespace reason. |
| src/HotChocolate/Core/src/Types/Types/Descriptors/ArgumentDescriptorBase~1.cs | Treat whitespace deprecation reason as “no reason provided”. |
| src/HotChocolate/Core/src/Types/Types/DefaultEnumValue.cs | Normalize deprecation via DeprecationReason only. |
| src/HotChocolate/Core/src/Types/Types/Contracts/EnumValue.cs | Make IsDeprecated derived from DeprecationReason at contract level. |
| src/HotChocolate/Core/src/Types.Abstractions/Types/Provider/IDeprecationProvider.cs | Define canonical semantics: deprecated iff reason present; add “default reason” helper. |
| src/HotChocolate/Core/src/Types.Abstractions/Types/IObjectTypeDefinition.cs | Remove explicit IsDeprecated override to rely on provider semantics. |
| src/HotChocolate/Core/src/Types.Abstractions/Types/IDirectiveDefinition.cs | Remove explicit IsDeprecated override to rely on provider semantics. |
| src/HotChocolate/Core/src/Types.Abstractions/Serialization/SchemaFormatter.cs | Require non-null deprecated reason when synthesizing @deprecated. |
| src/HotChocolate/Core/src/Types.Abstractions/Serialization/SchemaDebugFormatter.cs | Stop defaulting null reasons in debug formatter; rely on new contract. |
| src/HotChocolate/Core/src/Abstractions/GraphQLDeprecatedAttribute.cs | Reject whitespace deprecation reasons at attribute construction time. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
Patch coverage95.1% of changed lines covered (135/142) +19 more changed files; see the JSON below for uncovered lines. Uncovered changed lines (JSON){
"sha": "986cc8a2c029a77deaf6e156538ccae74b537e7b",
"files": [
{ "path": "src/HotChocolate/Core/src/Types/Types/Descriptors/Configurations/DirectiveTypeConfiguration.cs", "ranges": [[60, 60]] },
{ "path": "src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Nodes/TypeNameField.cs", "ranges": [[49, 49]] },
{ "path": "src/StrawberryShake/CodeGeneration/src/CodeGeneration/Analyzers/FieldCollector.cs", "ranges": [[340, 340]] },
{ "path": "src/HotChocolate/Core/src/Types.Analyzers/Helpers/CompilationExtensions.cs", "ranges": [[169, 169]] },
{ "path": "src/HotChocolate/Core/src/Types.Abstractions/Serialization/SchemaDebugFormatter.cs", "ranges": [[169, 171]] }
]
}Project coverage: 54.4% (242249/445542 lines) |
This was referenced Aug 16, 2026
This was referenced Aug 25, 2026
Closed
Closed
Closed
Closed
This was referenced Sep 1, 2026
Closed
This was referenced Sep 15, 2026
Closed
[nuget][SUI_Matcher]- Bump the sui-package-updates group with 20 updates
DFE-Digital/SUI_Matcher#405
Closed
This was referenced Sep 22, 2026
Closed
Closed
[nuget][SUI_Matcher]- Bump the sui-package-updates group with 20 updates
DFE-Digital/SUI_Matcher#410
Merged
This was referenced Oct 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.