MetadataGenerator
interface MetadataGenerator
A generator for arbitrary metadata associated with objects. For example, information about pagination can later be used to merge pages (see RecordMerger).
The metadata is stored and attached to the object's field in the Record resulting from the normalization. For instance, given the query query MyQuery { foo }
and an implementation of metadataForObject returning mapOf("key", 0)
, the resulting Record will look like fields: { foo: bar }, metadata: { foo: { key: 0 } }
.
See also
Inheritors
Functions
Link copied to clipboard
abstract fun metadataForObject(obj: ApolloJsonElement, context: MetadataGeneratorContext): Map<String, ApolloJsonElement>
Returns metadata for the given object. This is called for every field in the response, during normalization.