From 61e400f911c03c1d130aee3375e2fb45557bfc3d Mon Sep 17 00:00:00 2001 From: Steven Barker Date: Wed, 6 Mar 2024 12:34:00 +1300 Subject: [PATCH] change defer delayedResponses to a list --- .../test/kotlin/graphql/nadel/tests/TestFixture.kt | 9 ++++----- .../resources/fixtures/defer/defer-with-label.yml | 13 +++++++------ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/test/src/test/kotlin/graphql/nadel/tests/TestFixture.kt b/test/src/test/kotlin/graphql/nadel/tests/TestFixture.kt index db193def0..71a5fffaf 100644 --- a/test/src/test/kotlin/graphql/nadel/tests/TestFixture.kt +++ b/test/src/test/kotlin/graphql/nadel/tests/TestFixture.kt @@ -5,6 +5,7 @@ import com.fasterxml.jackson.annotation.JsonInclude import com.fasterxml.jackson.annotation.JsonInclude.Include.NON_DEFAULT import com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.core.type.TypeReference import com.fasterxml.jackson.module.kotlin.readValue import graphql.language.AstSorter import graphql.language.Document @@ -103,7 +104,7 @@ data class IncrementalResponse( @JsonProperty("initialResponse") val initialResponseJsonString: String, @JsonProperty("delayedResponses") - val delayedResponsesJsonString: String?, + val delayedResponsesJsonString: String, ) { @get:JsonIgnore @@ -112,9 +113,7 @@ data class IncrementalResponse( } @get:JsonIgnore - val delayedResponses: JsonMap? by lazy { - delayedResponsesJsonString?.let { - jsonObjectMapper.readValue(it) - } + val delayedResponses: List by lazy { + jsonObjectMapper.readValue(delayedResponsesJsonString, object : TypeReference>() {}) } } \ No newline at end of file diff --git a/test/src/test/resources/fixtures/defer/defer-with-label.yml b/test/src/test/resources/fixtures/defer/defer-with-label.yml index c4a78a5e5..ab386ef51 100644 --- a/test/src/test/resources/fixtures/defer/defer-with-label.yml +++ b/test/src/test/resources/fixtures/defer/defer-with-label.yml @@ -61,15 +61,16 @@ serviceCalls: "extensions": {} } delayedResponses: |- - { + [{ "hasNext": false, "incremental": [{ "data": { "slow": "snail" - + } }] - } + }] + # language=JSON @@ -97,12 +98,12 @@ incrementalResponse: "extensions": {} } delayedResponses: |- - { + [{ "hasNext": false, "incremental": [{ "data": { "slow": "snail" - + } }] - } + }]