Repository navigation
Validate directives on enum values and directive arguments - #10151
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request updates schema validation so that directives applied to enum values and directive-definition arguments are also validated (via published directive-related validation events), closing a gap where undefined directives at ENUM_VALUE and directive ARGUMENT_DEFINITION locations could previously pass silently.
Changes:
- Publish directive events for
IEnumValuemembers while walking enum values inSchemaValidator. - Publish directive events for arguments of directive definitions in
SchemaValidator. - Extend
DirectiveIsDefinedRuleTests.Validate_DirectiveIsUndefined_Failsto assert failures for undefined directives on an enum value and on a directive definition argument.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/HotChocolate/Core/test/Types.Validation.Tests/Rules/DirectiveIsDefinedRuleTests.cs | Adds coverage for undefined directives on enum values and directive-definition arguments. |
| src/HotChocolate/Core/src/Types.Validation/SchemaValidator.cs | Publishes directive events for enum values and directive-definition arguments so rules see and validate those directives. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
Patch coverage100.0% of changed lines covered (2/2)
Project coverage: 53.9% (232122/430885 lines) |
This was referenced Aug 6, 2026
Merged
This was referenced Aug 13, 2026
Closed
Closed
This was referenced Aug 25, 2026
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.
Summary
SchemaValidatorpublishes directive events for every directives provider it walks, including enum values and directive definition arguments. Directives applied at theENUM_VALUEandARGUMENT_DEFINITION(on a directive definition) locations were previously skipped, so rules keyed onDirectiveEventandDirectiveArgumentAssignmentEventnever saw them — an undefined directive there passed validation silently.Test plan
DirectiveIsDefinedRuleTests.Validate_DirectiveIsUndefined_Failsto cover a directive on an enum value and on a directive definition's argument alongside the existing object/field/argument cases.HotChocolate.Types.Validation.Tests(404 tests) andHotChocolate.Fusion.Composition.Tests(2848 tests, the only otherSchemaValidatorconsumer) pass on all target frameworks.