Skip to content

Add feign-graphql and feign-graphql-apt modules#3212

Merged
velo merged 4 commits intomasterfrom
feature/graphql-apt-module
Feb 9, 2026
Merged

Add feign-graphql and feign-graphql-apt modules#3212
velo merged 4 commits intomasterfrom
feature/graphql-apt-module

Conversation

@velo
Copy link
Copy Markdown
Member

@velo velo commented Feb 7, 2026

Summary

  • New feign-graphql module: a GraphQL contract, encoder, and decoder for Feign
  • New feign-graphql-apt module: an annotation processor that generates Java records from GraphQL schemas at compile time
  • Given a @GraphqlSchema-annotated interface with @GraphqlQuery methods, the processor validates queries against the schema and generates input/result records, enums, and nested types

feign-graphql module

  • GraphqlContract: extends Contract.Default, registers @GraphqlQuery annotation, stores query metadata (query string + variable name) in a map keyed by configKey
  • GraphqlEncoder: wraps a delegate Encoder, builds {query, variables} JSON body from contract metadata. Also implements RequestInterceptor for no-variable queries
  • GraphqlDecoder: unwraps GraphQL {data: {operationField: ...}} envelope. Supports pluggable delegate Decoder so users choose their JSON parser (Jackson, GSON, etc.)
  • GraphqlErrorException: thrown when the response contains GraphQL errors
  • No internal headers — metadata flows through configKey-based lookup

feign-graphql-apt module

  • Annotations: @GraphqlSchema(path) on interface, @GraphqlQuery(query) on methods
  • Validation: Queries are validated against the schema with line/column error reporting via Messager
  • Type mapping: GraphQL scalars → Java types (Int→Integer, Float→Double, ID→String, etc.), [T]→List<T>, enums → Java enums
  • Records: Generates Java records instead of POJOs — accessors use field() not getField()
  • Nested generation: Selection sets produce result types with only selected fields; input types include all schema-defined fields
  • Dependencies: graphql-java 22.4, javapoet 1.13.0, auto-service-annotations, compile-testing (test)
  • Java 17 required (matches apt-test-generator)

Test plan

  • 27 graphql tests pass (contract: 10, encoder: 5, client: 5, decoder: 7)
  • 16 graphql-apt compile-testing tests pass
  • mvn clean test -pl graphql,graphql-apt passes

velo added 2 commits February 9, 2026 13:17
Signed-off-by: Marvin Froeder <velo.br@gmail.com>
Signed-off-by: Marvin Froeder <velo.br@gmail.com>
@velo velo force-pushed the feature/graphql-apt-module branch from 27fcbb8 to 2e89d6b Compare February 9, 2026 16:17
velo added 2 commits February 9, 2026 13:45
Signed-off-by: Marvin Froeder <velo.br@gmail.com>
Signed-off-by: Marvin Froeder <velo.br@gmail.com>
@velo velo changed the title Add feign-graphql-apt module Add feign-graphql and feign-graphql-apt modules Feb 9, 2026
@velo velo merged commit d74ef99 into master Feb 9, 2026
4 checks passed
@velo velo deleted the feature/graphql-apt-module branch February 9, 2026 17:57
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