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: use CustomObjectMapper to serialize subscription data #1528

Closed
clayembry opened this issue May 15, 2023 · 2 comments · Fixed by #1540
Closed

feature: use CustomObjectMapper to serialize subscription data #1528

clayembry opened this issue May 15, 2023 · 2 comments · Fixed by #1540
Labels
enhancement New feature or request

Comments

@clayembry
Copy link
Contributor

Describe the Feature Request

A CustomObjectMapper can be supplied for serializing GraphQL responses. But that object mapper is not used to serialize subscription data. The objectMapper used to serialize subscription data is instantiated in the companion object for the WebsocketGraphQLWSProtocolHandler class.

This is causing our subscriptions to fail sending data because the objects we are trying to send contain OffsetDateTime fields that cause the ObjectMapper to throw exceptions because the JavaTimeModule is not registered with the subscription ObjectMapper.

Describe Preferred Solution

Please consider injecting the CustomObjectMapper into the WebsocketGraphQLWSProtocolHandler class to use for serializing subscription data.

@clayembry clayembry added the enhancement New feature or request label May 15, 2023
@coleturner
Copy link
Contributor

coleturner commented May 26, 2023

Hey @clayembry 👋

Our team met to discuss this issue and we came to the conclusion that we would prefer to internalize the mapping of objects used across the DGS framework, so we will instead add JavaTimeModule. Thanks for your patience as we hope to release this in the next week or two.

@clayembry
Copy link
Contributor Author

@coleturner - your fix did not fix the problem we are facing. Because neither WebsocketGraphQLWSProtocolHandler or WebsocketGraphQLTransportWSProtocolHandler inject the dgsObjectMapper.

Both of those classes that we are having issues with just instantiate their own plain ObjectMapper in the companion object using val objectMapper = jacksonObjectMapper().

Please fix so that those two classes inject the dgsObjectMapper and use it instead.

clayembry pushed a commit to clayembry/dgs-framework that referenced this issue Aug 16, 2023
…etAutoConfig to mirror DgsWebMvcAutoConfiguration.
srinivasankavitha pushed a commit that referenced this issue Aug 21, 2023
#1602)

* Fix for #1528, setup ObjectMapper configuration for DgsWebSocketAutoConfig to mirror DgsWebMvcAutoConfiguration.

* PR feedback. Removing unnecessary dgsObjectMapper bean since it will be created by the dgs starter auto config.

* Linter updates.

* Removed unused imports

---------

Co-authored-by: Clay Embry <cembry@atlassian.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants