Skip to content

Generate nested result types as inner records in graphql-apt#3247

Merged
velo merged 3 commits intomasterfrom
graphql-apt-inner-records
Feb 27, 2026
Merged

Generate nested result types as inner records in graphql-apt#3247
velo merged 3 commits intomasterfrom
graphql-apt-inner-records

Conversation

@velo
Copy link
Member

@velo velo commented Feb 27, 2026

Summary

  • Nested result types (e.g., Location from location { planet sector }) are now generated as public record inner classes within their parent result type, instead of separate top-level files
  • Each query result type gets its own scoped nested type definitions, preventing conflicts when different queries select different fields from the same GraphQL type
  • Added conflict detection: if two queries use the same return type name but select different fields, a compilation error is reported
  • Replaced test schema with Star Wars-themed types (from graphql.org) for better readability

Test plan

  • All 20 tests pass (mvn clean test -pl graphql-apt)
  • New test: conflictingReturnTypesReportsError — same return type, different field selections → error
  • New test: sameReturnTypeSameFieldsSucceeds — same return type, same selections → OK
  • New test: innerClassContentIsCorrect — verifies exact structure of generated inner records
  • New test: differentQueriesDifferentNestedFields — two queries selecting different Location fields each get their own inner class

🤖 Generated with Claude Code

velo added 3 commits February 27, 2026 08:16
Signed-off-by: Marvin Froeder <velo.br@gmail.com>
Signed-off-by: Marvin Froeder <velo.br@gmail.com>
Signed-off-by: Marvin Froeder <velo.br@gmail.com>
@velo velo merged commit 05d7897 into master Feb 27, 2026
3 of 4 checks passed
@velo velo deleted the graphql-apt-inner-records branch February 27, 2026 11: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