Skip to content

Validate required GraphQL variables at compile time#3268

Merged
velo merged 2 commits intomasterfrom
graphql-apt-validate-required-variables
Mar 16, 2026
Merged

Validate required GraphQL variables at compile time#3268
velo merged 2 commits intomasterfrom
graphql-apt-validate-required-variables

Conversation

@velo
Copy link
Copy Markdown
Member

@velo velo commented Mar 16, 2026

Summary

  • Adds compile-time validation that required GraphQL variables (non-null without default values) have corresponding Java method parameters
  • Parameters annotated with @feign.Param are excluded from variable matching (they're header params)
  • Errors point to the method element with actionable messages including variable name and type

Test plan

  • missingRequiredVariableReportsError — missing required var emits error
  • requiredVariableWithDefaultValueIsOptional — default value makes it optional
  • nullableVariableIsOptional — nullable types don't require params
  • paramAnnotationNotCountedAsVariable@Param params excluded from matching
  • requiredVariableWithMatchingParameterSucceeds — matching param passes
  • multipleRequiredVariablesMissing — reports errors for each missing var
  • All 26 tests pass (mvn test -pl graphql-apt)

velo added 2 commits March 16, 2026 09:45
…t compile time

Signed-off-by: Marvin Froeder <velo.br@gmail.com>
Signed-off-by: Marvin Froeder <velo.br@gmail.com>
@velo velo merged commit 87bf53d into master Mar 16, 2026
3 checks passed
@velo velo deleted the graphql-apt-validate-required-variables branch March 16, 2026 14:41
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.

1 participant