-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Rest Client Reactive: Provide custom ObjectMapper in request scope #27203
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This comment has been minimized.
This comment has been minimized.
Sgitario
force-pushed
the
contextresolver_restclient
branch
from
August 10, 2022 05:02
8cae241
to
57ce196
Compare
This comment has been minimized.
This comment has been minimized.
Sgitario
force-pushed
the
contextresolver_restclient
branch
from
August 25, 2022 11:56
57ce196
to
c9083d5
Compare
michalszynkiewicz
approved these changes
Aug 25, 2022
This comment has been minimized.
This comment has been minimized.
Sgitario
force-pushed
the
contextresolver_restclient
branch
from
August 26, 2022 05:11
c9083d5
to
2978c5f
Compare
With these changes, we can now register custom object mappers when creating a client programmatically: ``` clientAllowsUnknown = RestClientBuilder.newBuilder() .baseUrl(new URL(wireMockServer.baseUrl())) .register(ClientObjectMapperUnknown.class) .build(MyClient.class); ``` where ClientObjectMapperUnknown is: ``` public static class ClientObjectMapperUnknown implements ContextResolver<ObjectMapper> { @OverRide public ObjectMapper getContext(Class<?> type) { return new ObjectMapper() .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) .disable(SerializationFeature.FAIL_ON_EMPTY_BEANS); } } ``` I implemented this feature by injecting the rest client context via the interface ClientRestHandler. Then, the rest client context has registered all the context resolvers, so the jackson message reader/writer can get the custom object mappers. Fix quarkusio#26152 Relates quarkusio#26988
Sgitario
force-pushed
the
contextresolver_restclient
branch
from
August 26, 2022 07:17
2978c5f
to
d9a9b55
Compare
Sgitario
added a commit
to Sgitario/quarkus
that referenced
this pull request
Jan 18, 2023
After quarkusio#27203, we can customize the object mappers to be used by REST Client Reactive. However, because of quarkusio#16368, the implementation was never picked up when the resteasy reactive jackson extension is in place. I tried to remove the ResteasyReactiveJacksonProviderDefinedBuildItem build item and surprisingly everything kept working fine (I verified the test that was added as part of quarkusio#16368. Fix quarkusio#23979
Sgitario
added a commit
to Sgitario/quarkus
that referenced
this pull request
Jan 18, 2023
After quarkusio#27203, we can customize the object mappers to be used by REST Client Reactive. However, because of quarkusio#16368, the implementation was never picked up when the resteasy reactive jackson extension is in place. I tried to remove the ResteasyReactiveJacksonProviderDefinedBuildItem build item and surprisingly everything kept working fine (I verified the test that was added as part of quarkusio#16368. Fix quarkusio#23979
Sgitario
added a commit
to Sgitario/quarkus
that referenced
this pull request
Jan 18, 2023
After quarkusio#27203, we can customize the object mappers to be used by REST Client Reactive. However, because of quarkusio#16368, the implementation was never picked up when the resteasy reactive jackson extension is in place. I tried to remove the ResteasyReactiveJacksonProviderDefinedBuildItem build item and surprisingly everything kept working fine (I verified the test that was added as part of quarkusio#16368. Fix quarkusio#23979
Sgitario
added a commit
to Sgitario/quarkus
that referenced
this pull request
Jan 19, 2023
After quarkusio#27203, we can customize the object mappers to be used by REST Client Reactive. However, because of quarkusio#16368, the implementation was never picked up when the resteasy reactive jackson extension is in place. I tried to remove the ResteasyReactiveJacksonProviderDefinedBuildItem build item and surprisingly everything kept working fine (I verified the test that was added as part of quarkusio#16368. Fix quarkusio#23979
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
With these changes, we can now register custom object mappers when creating a client programmatically:
where ClientObjectMapperUnknown is:
I implemented this feature by injecting the rest client context via the interface ClientRestHandler. Then, the rest client context has registered all the context resolvers, so the jackson message reader/writer can get the custom object mappers.
Fix #26152
Relates #26988