DeferredJsonMerger

Utility class for merging GraphQL JSON payloads received in multiple chunks when using the @defer directive.

Each call to merge will merge the given chunk into the merged Map, and will also update the mergedFragmentIds Set with the value of its path and label field.

The fields in data are merged into the node found in merged at path (for the first call to merge, the payload is copied to merged as-is).

errors in incremental items (if present) are merged together in an array and then set to the errors field of the merged Map, at each call to merge. extensions in incremental items (if present) are merged together in an array and then set to the extensions/incremental field of the merged Map, at each call to merge.

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
Link copied to clipboard

A payload can sometimes have no incremental field, e.g. when the server couldn't predict if there were more data after the last emitted payload. This field allows to test for this in order to ignore such payloads. See https://github.com/apollographql/router/issues/1687.

Link copied to clipboard

Functions

Link copied to clipboard
fun merge(payload: JsonMap): JsonMap
fun merge(payload: BufferedSource): JsonMap
Link copied to clipboard
fun reset()