Skip to content

Validate constant directive values on variable definitions (#3927)#4271

Open
andimarek wants to merge 6 commits intomasterfrom
claude/fix-issue-3927-mrgkP
Open

Validate constant directive values on variable definitions (#3927)#4271
andimarek wants to merge 6 commits intomasterfrom
claude/fix-issue-3927-mrgkP

Conversation

@andimarek
Copy link
Member

Per the GraphQL spec, directives applied to variable definitions accept
only constant values. Variable references like $v are not allowed in
directive arguments on variable definitions. For example, the query
query ($v:Int @dir(arg:$v)) { ... } should be rejected.

Add a new validation rule VARIABLES_NOT_ALLOWED_IN_DIRECTIVES_ON_VARIABLE_DEFINITIONS
that detects variable references inside directive arguments on variable
definitions and reports a VariableNotAllowed error.

https://claude.ai/code/session_01QH4Ce5Fs9zfEjktZV4j1i2

Per the GraphQL spec, directives applied to variable definitions accept
only constant values. Variable references like $v are not allowed in
directive arguments on variable definitions. For example, the query
`query ($v:Int @dir(arg:$v)) { ... }` should be rejected.

Add a new validation rule VARIABLES_NOT_ALLOWED_IN_DIRECTIVES_ON_VARIABLE_DEFINITIONS
that detects variable references inside directive arguments on variable
definitions and reports a VariableNotAllowed error.

https://claude.ai/code/session_01QH4Ce5Fs9zfEjktZV4j1i2
Copy link
Member

@bbakerman bbakerman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Claude

@graphql-java graphql-java deleted a comment from github-actions bot Mar 9, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 9, 2026

Test Report

Test Results

Java Version Total Passed Failed Errors Skipped
Java 11 5715 (+7 🟢) 5659 (+7 🟢) 0 (±0) 0 (±0) 56 (±0)
Java 17 5715 (+7 🟢) 5658 (+7 🟢) 0 (±0) 0 (±0) 57 (±0)
Java 21 5715 (+7 🟢) 5658 (+7 🟢) 0 (±0) 0 (±0) 57 (±0)
Java 25 5715 (+7 🟢) 5658 (+7 🟢) 0 (±0) 0 (±0) 57 (±0)
jcstress 32 (±0) 32 (±0) 0 (±0) 0 (±0) 0 (±0)
Total 22892 (+28 🟢) 22665 (+28 🟢) 0 (±0) 0 (±0) 227 (±0)

Code Coverage (Java 25)

Metric Covered Missed Coverage vs Master
Lines 28791 3123 90.2% ±0.0%
Branches 8368 1510 84.7% ±0.0%
Methods 7700 1223 86.3% ±0.0%

Changed Class Coverage (1 class)

Class Line Branch Method
g.v.OperationValidator -0.1% 🔴 -0.1% 🔴 ±0.0%
OperationValidator — method details
Method Line Branch
checkVariable new 100.0% 100.0%
validateVariableNotAllowedInConstantDirective new 92.3% 83.3%
checkVariable removed removed

Full HTML report: build artifact jacoco-html-report

Updated: 2026-03-19 11:08:22 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants