quarkus icon indicating copy to clipboard operation
quarkus copied to clipboard

Rest Client Reactive: Provide custom ObjectMapper in request scope

Open Sgitario opened this issue 3 years ago • 2 comments

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 https://github.com/quarkusio/quarkus/issues/26152 Relates https://github.com/quarkusio/quarkus/pull/26988

Sgitario avatar Aug 09 '22 11:08 Sgitario


:waning_crescent_moon: This workflow status is outdated as a new workflow run has been triggered.


Failing Jobs - Building 8cae24188bca267c93efa18626f9d9385c8d35c7

Status Name Step Failures Logs Raw logs
JVM Tests - JDK 11 Build Failures Logs Raw logs
:heavy_check_mark: JVM Tests - JDK 17
:heavy_check_mark: JVM Tests - JDK 18

Full information is available in the Build summary check run.

Failures

:gear: JVM Tests - JDK 11 #

- Failing: extensions/grpc/deployment integration-tests/smallrye-context-propagation 
! Skipped: integration-tests/devmode integration-tests/grpc-hibernate integration-tests/grpc-hibernate-reactive and 5 more

:package: extensions/grpc/deployment

io.quarkus.grpc.server.devmode.GrpcDevModeTest.testEchoStreamReload - More details - Source on GitHub

java.util.concurrent.RejectedExecutionException
	at org.jboss.threads.RejectingExecutor.execute(RejectingExecutor.java:38)
	at org.jboss.threads.EnhancedQueueExecutor.rejectShutdown(EnhancedQueueExecutor.java:2076)

:package: integration-tests/smallrye-context-propagation

io.quarkus.context.test.SimpleContextPropagationTest.testArcMEContextPropagationDisabled line 83 - More details - Source on GitHub

org.opentest4j.AssertionFailedError: expected: <2> but was: <1>
	at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
	at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)

quarkus-bot[bot] avatar Aug 09 '22 14:08 quarkus-bot[bot]


:waning_crescent_moon: This workflow status is outdated as a new workflow run has been triggered.


Failing Jobs - Building 57ce196556006283dc329726c8eec8f423339c45

Status Name Step Failures Logs Raw logs
Gradle Tests - JDK 11 Build Failures Logs Raw logs
:heavy_check_mark: Gradle Tests - JDK 11 Windows

Full information is available in the Build summary check run.

Failures

:gear: Gradle Tests - JDK 11 #

- Failing: integration-tests/gradle 

:package: integration-tests/gradle

io.quarkus.gradle.devmode.CompositeBuildWithDependenciesDevModeTest.main line 24 - More details - Source on GitHub

org.awaitility.core.ConditionTimeoutException: Condition with lambda expression in io.quarkus.test.devmode.util.DevModeTestUtils that uses java.util.function.Supplier, java.util.function.Supplierjava.util.concurrent.atomic.AtomicReference, java.util.concurrent.atomic.AtomicReferencejava.lang.String, java.lang.Stringboolean was not fulfilled within 1 minutes.
	at org.awaitility.core.ConditionAwaiter.await(ConditionAwaiter.java:167)
	at org.awaitility.core.CallableCondition.await(CallableCondition.java:78)

quarkus-bot[bot] avatar Aug 10 '22 07:08 quarkus-bot[bot]


:waning_crescent_moon: This workflow status is outdated as a new workflow run has been triggered.


Failing Jobs - Building c9083d51dd6cb36951afd3700f45f53602549ed3

Status Name Step Failures Logs Raw logs
JVM Tests - JDK 11 Build Failures Logs Raw logs
:heavy_check_mark: JVM Tests - JDK 17
:heavy_check_mark: JVM Tests - JDK 18

Full information is available in the Build summary check run.

Failures

:gear: JVM Tests - JDK 11 #

- Failing: integration-tests/micrometer-prometheus 

:package: integration-tests/micrometer-prometheus

io.quarkus.it.micrometer.prometheus.ClientRequestTest.testClientRequests line 36 - More details - Source on GitHub

java.lang.AssertionError: 
1 expectation failed.
Response body doesn't match expectation.

quarkus-bot[bot] avatar Aug 25 '22 14:08 quarkus-bot[bot]