Skip to content

HttpSyncGraphQlClient toEntityList returning List<LinkedHashMap> instead of typed objects #1383

@cw-juyeonyu

Description

@cw-juyeonyu

Hello, thank you for the great work on this project.

I am currently facing an issue where HttpSyncGraphQlClient seems to return a List instead of the specified target type list when using toEntityList.

I expected the response to be deserialized into my data class, but I am receiving a list of Maps instead. Please let me know if I am missing any configuration or if there is a mistake in how I am using the client code.

Steps to Reproduce

GraphQL Schema:

type Query {
  exampleResources: [ExampleResource!]!
}

type ExampleResource {
  id: ID!
  name: String
}

Client code:

// Target Data Class
data class ExampleResource(
    val id: String,
    val name: String?
)

// Client Implementation
val client = HttpSyncGraphQlClient.builder()
    .url("http://localhost:8080/graphql")
    .build()

// The issue occurs here: data becomes List<LinkedHashMap>
val data = client.document("query { exampleResources { id name } }")
    .retrieveSync("exampleResources")
    .toEntityList<ExampleResource>()

The data variable is returned as a List, resulting in type mismatch issues.

Environment

  • java: 21
  • kotlin: 2.2.21
  • spring boot: 4.0.0

I would appreciate any guidance or advice you could provide. Thank you!

Metadata

Metadata

Assignees

Labels

in: webIssues related to web handlingtype: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions