Skip to content

Commit

Permalink
Fix deserialization of GraphQLErrorDebugInfo
Browse files Browse the repository at this point in the history
A recent Jackson upgrade broke deserialization of GraphQLErrorDebugInfo, and the recent fix
broke the existing behavior of collecting unknown properties into the additionalInformation field.
Add an explicit qualifier for the JsonAnySetter annotation so that it gets applied to the backing field
and restores the old behavior, and re-enable the test case now that it passes.
  • Loading branch information
kilink committed Jun 21, 2024
1 parent 75aff39 commit 704146b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,11 @@ data class GraphQLErrorExtensions(
@JsonProperty val classification: Any = ""
)

@JsonIgnoreProperties(ignoreUnknown = true)
data class GraphQLErrorDebugInfo(
@JsonProperty val subquery: String = "",
@JsonProperty val variables: Map<String, Any> = emptyMap(),
@JsonAnySetter @get:JsonAnyGetter
val additionalInformation: Map<String, Any> = hashMapOf()
@field:JsonAnySetter @get:JsonAnyGetter
val additionalInformation: Map<String, Any?> = hashMapOf()
)

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package com.netflix.graphql.dgs.client

import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Disabled
import org.junit.jupiter.api.Test
import org.springframework.http.HttpEntity
import org.springframework.http.HttpHeaders
Expand Down Expand Up @@ -179,7 +178,6 @@ class ErrorsTest {
}

@Test
@Disabled("Broken by Jackson 2.17 https://github.com/FasterXML/jackson-databind/issues/4508")
fun errorWithDebugInfo() {
val jsonResponse = """
{
Expand Down

0 comments on commit 704146b

Please sign in to comment.