-
Notifications
You must be signed in to change notification settings - Fork 13
Migration Guide
Maxwell edited this page Jun 18, 2026
·
4 revisions
retrofit-graphql v2.x introduces a modular architecture. The old :library module is now a deprecated backward-compatible aggregator. This guide shows how to migrate your project.
If you use all library features and want no code changes:
// Old
dependencies {
implementation 'com.github.anitrend:retrofit-graphql:2.x'
}
// New — same artifact, same API. Deprecated but fully functional.
dependencies {
implementation 'com.github.anitrend:retrofit-graphql:2.x'
}The aggregator is deprecated but will receive critical fixes for the foreseeable future.
Migrate to individual modules for smaller build footprint and clearer dependencies:
// Asset-based GraphQL queries (traditional approach)
dependencies {
implementation project(':runtime') // Retrofit converter
implementation project(':api') // QueryContainerBuilder, GraphQLOperation
implementation project(':android-assets') // GraphProcessor, asset discovery
implementation project(':annotations') // @GraphQuery annotation
}v2.x adds optional build-time code generation:
plugins {
id 'co.anitrend.retrofit.graphql.codegen' version '2.x'
}
dependencies {
implementation project(':runtime')
implementation project(':api')
implementation project(':annotations')
// android-assets NOT needed — codegen replaces asset discovery
}
retrofitGraphQL {
packageName 'your.package.generated'
schema file('src/main/graphql/schema.graphql')
operations.from fileTree('src/main/graphql') {
include '**/*.graphql'
}
}Move your .graphql files from assets/graphql/ to src/main/graphql/.
Generated output includes GeneratedGraphQLRegistry that you wire into your converter:
val factory = GraphConverter.create(
context = androidContext(),
registry = GeneratedGraphQLRegistry,
)Old (io.github.wax911.library.*) |
New (co.anitrend.retrofit.graphql.*) |
|---|---|
io.github.wax911.library.annotation.GraphQuery |
co.anitrend.retrofit.graphql.annotation.GraphQuery |
io.github.wax911.library.converter.GraphConverter |
co.anitrend.retrofit.graphql.converter.GraphConverter |
io.github.wax911.library.model.body.GraphContainer |
co.anitrend.retrofit.graphql.model.body.GraphContainer |
io.github.wax911.library.model.request.QueryContainerBuilder |
co.anitrend.retrofit.graphql.model.request.QueryContainerBuilder |
| Module | Purpose | Required for codegen? |
|---|---|---|
:annotations |
@GraphQuery annotation |
Yes |
:api |
Public API interfaces and models | Yes |
:runtime |
Retrofit Converter.Factory | Yes |
:android-assets |
Asset-based query discovery | No (use codegen instead) |
:codegen-core |
Code generation engine | Plugin dependency |
:gradle-plugin |
Gradle plugin for codegen | Plugin dependency |
:serialization-gson |
Gson-backed serialization | No (use Retrofit's Gson converter directly) |
:serialization-kotlinx |
kotlinx.serialization backend | No |
- MIGRATION.md — comprehensive migration guide in the main repo
- Getting Started — asset-based workflow
- Home — project overview