Skip to content

Add Optional wrapping, type/field annotations, and type overrides for GraphQL APT#3269

Merged
velo merged 4 commits intomasterfrom
graphql-apt-optional-and-type-annotations
Mar 16, 2026
Merged

Add Optional wrapping, type/field annotations, and type overrides for GraphQL APT#3269
velo merged 4 commits intomasterfrom
graphql-apt-optional-and-type-annotations

Conversation

@velo
Copy link
Copy Markdown
Member

@velo velo commented Mar 16, 2026

Summary

  • Nullable GraphQL fields wrapped in Optional<> by default (useOptional = true on @GraphqlSchema, overridable per method via Toggle)
  • typeAnnotations/rawTypeAnnotations on @GraphqlSchema and @GraphqlQuery to add annotations to all generated records (e.g. @Builder, @Jacksonized)
  • Collision rule: when same annotation in both typeAnnotations and rawTypeAnnotations, the class provides only the import
  • uses on @GraphqlSchema for import-only classes (needed by raw annotations)
  • @GraphqlField (repeatable, class + method level) for field-level annotations, type overrides, and dot notation for nested fields
  • nonNullTypeAnnotations/nonNullRawTypeAnnotations to auto-annotate all non-null (!) fields (e.g. @NotNull)
  • Shared unwrapTypeName/findFieldDefinition in GraphqlTypeMapper, deduplicated annotation resolution logic

Test plan

  • 55 tests covering all new features: Optional wrapping, type annotations, raw annotations, collision behavior, field annotations, dot notation, type overrides, non-null annotations, uses imports, class/method level inheritance
  • All existing tests updated to reflect useOptional = true default
  • mvn test passes for graphql and graphql-apt modules

🤖 Generated with Claude Code

velo added 4 commits March 16, 2026 17:31
…ations on generated GraphQL types

Signed-off-by: Marvin Froeder <velo.br@gmail.com>
…l field annotations, and uses for imports

Signed-off-by: Marvin Froeder <velo.br@gmail.com>
…code

Signed-off-by: Marvin Froeder <velo.br@gmail.com>
…deduplicate getRootType switch

Signed-off-by: Marvin Froeder <velo.br@gmail.com>
@velo velo merged commit 51569ac into master Mar 16, 2026
4 checks passed
@velo velo deleted the graphql-apt-optional-and-type-annotations branch March 16, 2026 22:30
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