Comments (6)
/cc @cescoffier (rest-client), @geoand (jackson,rest-client), @gsmet (jackson), @maxandersen (jbang), @quarkusio/devtools (jbang)
from quarkus.
As far as i know Quarkus supports only JAX-B for XML serialisation/deserialisation.
Maybe you could write your own MessageBodyWriter / MessageBodyReader (https://quarkus.io/guides/rest#readers-and-writers-mapping-entities-and-http-bodies). I know it works for Quarkus-REST, for the REST-Client i am not sure.
from quarkus.
Yes, it's for rest service not for client.
In fact I find a workaround
package com.client;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
import io.quarkus.rest.client.reactive.jackson.ClientObjectMapper;
import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;
import java.io.IOException;
import java.io.InputStream;
import static com.fasterxml.jackson.databind.DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES;
@Path("/api")
@RegisterRestClient(configKey = "my-api")
public interface CustomRestClient {
@GET
@Consumes("application/xml")
InputStream get();
default MyXmlObject get2() throws IOException {
final ObjectMapper mapper = XmlMapper.builder()
.configure(FAIL_ON_UNKNOWN_PROPERTIES, false)
.build();
return mapper.readValue(get(), MyXmlObject.class);
}
}
In my case I need only one call, so I can create mapper directly in get 2.
I use extension quarkus-rest-client
not quarkus-rest-client-jackson
.
But I think it's a bug. Normally we should use extension quarkus-rest-client-jackson
and configure the ObjectMapper like we want. It seems there are some restrictions on media type. But Jackson can serialize and deserialize multiple data format
from quarkus.
Thanks for reporting this.
I'll say right off the bat, that I do not consider this a bug. The quarkus-rest-client-jackson
extension is only meant to handle json (one could argue that the name could be better, but that's not going to change).
It is absolutely possible to use other formats, but you need to handle add your own MessageBodyReader and MessageBodyWriter implementations.
from quarkus.
It's a shame to limit this lib to the json format, given that Jackson manages several of them. If it's not a bug, it could be an enhancement or a name change of lib.
Thanks for the feedback.
from quarkus.
it could be an enhancement or a name change of lib.
Right, we should consider this
from quarkus.
Related Issues (20)
- Remove references to Renarde in https://quarkus.io/guides/security-openid-connect-providers HOT 3
- Add virtual threads support for all framework features including @Asynchronous & @Inject ExecutorService with Quarkus on JDK21 and later HOT 2
- CredentialsProvider is no longer calling the @PostConstruct init method prior to calling the getCredentials method HOT 1
- Listen on Unix Domain Socket passed via FD
- Deprecate `quarkus.datasource.jdbc.tracing` HOT 2
- be explicit/use examples in websocket.next docs when it comes to subscribe call for action
- CLI in version 3.8.5 does not properly update HOT 8
- quarkus update sometimes fails to correctly update @QuarkusTestResource HOT 5
- when/if onTextMessage throws exception connection is "quietly" closed without explanation
- Qute template detection has changed on Windows for templates in project dependencies HOT 7
- state which category to enable debugging for
- Keycloak admin client - error response body is unreachable HOT 3
- OTEL + `quarkus.http.test-timeout` -> NullPointerException: Cannot invoke "io.vertx.core.spi.observability.HttpResponse.headers()" because "httpResponse" is null HOT 2
- `application-test.properties` leaks into downstream module tests even though only `application.properties` is included in the test-jar HOT 1
- Error connecting Cloud Run to Cloud SQL.
- [Feature Request] Infinispan as Hibernate second-level cache provider HOT 1
- SRMSG18245: There are still 140 unprocessed messages after the closing timeout HOT 1
- Custom Smallrye ConfigSourceInterceptor not loading class using Gradle
- Quarkus Update - missing recipe for keycloak config changes HOT 3
- StringIndexOutOfBoundsException on OAuth2AuthMechanism HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from quarkus.