GraphConverter
Deprecated
Legacy Gson/GraphQLJson-backed converter. Use GraphQLConverterFactory with an explicit GraphQLTransportCodec instead.
Body for GraphQL requests and responses, closed for modification but open for extension.
Legacy: this Gson/GraphQLJson-backed converter lives in :compat for backward compatibility with the historical artifact and the asset-based discovery flow. New code should use the backend-neutral GraphQLConverterFactory from :runtime with an explicit co.anitrend.retrofit.graphql.serialization.GraphQLTransportCodec.
Serialization Backend
As of v0.13.x, GraphConverter uses a pluggable GraphQLJson instance instead of a hard dependency on Gson. The json property provides the serialization backend for both request and response conversion. Factory methods accept either a GraphQLJson instance directly or a Gson instance (preserved for backward compatibility, internally wrapped in GsonGraphQLJson).
Factory Methods
Context-backed (5 overloads: 4 Gson preserved + 1 GraphQLJson new)
// Default Gson (backward compatible)
GraphConverter.create(context)
// Custom Gson (backward compatible)
GraphConverter.create(context, gson)
// Custom Gson + registry (backward compatible)
GraphConverter.create(context, gson, registry)
// Default Gson + registry (backward compatible)
GraphConverter.create(context, registry)
// NEW: Custom GraphQLJson + registry
GraphConverter.create(context, json, registry)Registry-only, no Context (3 overloads: 2 Gson preserved + 1 GraphQLJson new)
// Default Gson (backward compatible)
GraphConverter.create(registry)
// Custom Gson (backward compatible)
GraphConverter.create(gson, registry)
// NEW: Custom GraphQLJson
GraphConverter.create(json, registry)Extending
Subclass GraphConverter to customize request/response conversion:
class CustomGraphConverter(
processor: AbstractGraphProcessor,
json: GraphQLJson,
) : GraphConverter(processor, json) {
override fun responseBodyConverter(...) = CustomResponseConverter(...)
}Parameters
Processor used for asset-based lookup. Registry-only factory overloads provide a no-op implementation when no asset fallback is required.
Pluggable GraphQLJson instance used for request and response serialization. Replaces the v2.x gson: Gson parameter.
Optional GraphQLDocumentRegistry for build-time generated operation documents.
See also
Constructors
Functions
Response body converter delegates logic processing to a child class that handles wrapping and deserialization of the json response data.
Response body converter delegates logic processing to a child class that handles wrapping and deserialization of the json response data.
Sets the minimum level for log messages. Attempted messages with a too low log level are skipped and not printed to the system log.
Overrides the minimum level for log messages on the logger.