fix: reject duplicate enum values and repeated non-repeatable directives#436
Merged
StevenACoffman merged 1 commit intoJun 6, 2026
Conversation
Collaborator
|
Would you mind changing your commit to not attribute claude? There's also a minor formatting nit: |
19cf88b to
45130a0
Compare
LoadSchema silently merged duplicate enum values (no uniqueness check), unlike object fields which already error with "Field X.Y can only be defined once." Add the equivalent check for enum values, reported as "Enum value X.Y can only be defined once." Also enforce that a non-repeatable directive is applied at most once per schema location during schema validation (the executable-document rule in validator/rules already covers queries, but the type system was unchecked). The check is scoped to single authored locations via a singleLocation flag: a type's own directives are merged across its base definition and every extension, which the spec treats as distinct locations, so the merged list is exempt to avoid rejecting a directive used once per location. Adds YAML cases covering duplicate enum values (same definition and across an extension), a repeated non-repeatable directive on a field and on an enum value, and positive cases (repeatable directive, the same directive on distinct locations, and a directive on a type plus its extension). Fixes vektah#435
45130a0 to
4ed950c
Compare
Contributor
Author
|
removed Claude attribution and fixed formatting |
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.
LoadSchema silently merged duplicate enum values (no uniqueness check), unlike object fields which already error with "Field X.Y can only be defined once." Add the equivalent check for enum values, reported as "Enum value X.Y can only be defined once."
Also enforce that a non-repeatable directive is applied at most once per schema location during schema validation (the executable-document rule in validator/rules already covers queries, but the type system was unchecked). The check is scoped to single authored locations via a singleLocation flag: a type's own directives are merged across its base definition and every extension, which the spec treats as distinct locations, so the merged list is exempt to avoid rejecting a directive used once per location.
Adds YAML cases covering duplicate enum values (same definition and across an extension), a repeated non-repeatable directive on a field and on an enum value, and positive cases (repeatable directive, the same directive on distinct locations, and a directive on a type plus its extension).
Fixes #435
Describe your PR and link to any relevant issues.
I have: