Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: RestClientGraphQLClient should allow to use common message converters #2060

Open
GFriedrich opened this issue Nov 11, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request investigate

Comments

@GFriedrich
Copy link

GFriedrich commented Nov 11, 2024

Describe the Feature Request

Right now the RestClientGraphQLClient either asks for an ObjectMapper or uses the default one from the GraphQLClients object.
The question here is: Why is an additional ObjectMapper needed at all? By default Spring already registers a couple of message converters that take care of converting complex objects to strings for the HTTP request, so I would like to be able to use those converters without any additional ObjectMapper usage.

Describe Preferred Solution

Instead of converting the request at

val serializedRequest =
mapper.writeValueAsString(
GraphQLClients.toRequestMap(query = query, operationName = operationName, variables = variables),
)

the request should be sent "as-is" down to the RestClient if no ObjectMapper is set, so that the common message converters are utilized.
This in turn will cause a slight problem with the GraphQLClientException which then wouldn't be able to get the actual sent request, but I would suggest to simply use the actual request map that was forwarded to the RestClient within the exception. It would also allow for a better way of handling the request details in a potential exception handler.

Describe Alternatives

N/A

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request investigate
Projects
None yet
Development

No branches or pull requests

3 participants