Skip to content

Commit

Permalink
change defer delayedResponses to a list
Browse files Browse the repository at this point in the history
  • Loading branch information
sbarker2 committed Mar 5, 2024
1 parent 90db233 commit 61e400f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
9 changes: 4 additions & 5 deletions test/src/test/kotlin/graphql/nadel/tests/TestFixture.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -103,7 +104,7 @@ data class IncrementalResponse(
@JsonProperty("initialResponse")
val initialResponseJsonString: String,
@JsonProperty("delayedResponses")
val delayedResponsesJsonString: String?,
val delayedResponsesJsonString: String,
)
{
@get:JsonIgnore
Expand All @@ -112,9 +113,7 @@ data class IncrementalResponse(
}

@get:JsonIgnore
val delayedResponses: JsonMap? by lazy {
delayedResponsesJsonString?.let {
jsonObjectMapper.readValue(it)
}
val delayedResponses: List<JsonMap> by lazy {
jsonObjectMapper.readValue(delayedResponsesJsonString, object : TypeReference<List<JsonMap>>() {})
}
}
13 changes: 7 additions & 6 deletions test/src/test/resources/fixtures/defer/defer-with-label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,16 @@ serviceCalls:
"extensions": {}
}
delayedResponses: |-
{
[{
"hasNext": false,
"incremental": [{
"data": {
"slow": "snail"
}
}]
}
}]


# language=JSON

Expand Down Expand Up @@ -97,12 +98,12 @@ incrementalResponse:
"extensions": {}
}
delayedResponses: |-
{
[{
"hasNext": false,
"incremental": [{
"data": {
"slow": "snail"
}
}]
}
}]

0 comments on commit 61e400f

Please sign in to comment.