Search code examples
quarkusquarkus-rest-clientquarkus-reactive

Quarkus Rest client JSON serialization: equivalent of @JsonIgnore to ignore some field in serialization


How to ignore a field in a Quarkus Rest Client request body? I see in the dependency tree, this is listed:

io.quarkus:quarkus-resteasy-reactive-jsonb:jar:2.7.5.Final:compile

And using @JsonIgnore or JsonProperty(access = JsonProperty.Access.WRITE_ONLY) from com.fasterxml.jackson.annotation is not working.

I guess it is because MessageBodyWriter is using Jsonb providers, not Jackson.


Solution

  • When you use quarkus-resteasy-reactive-jsonb instead of quarkus-resteasy-reactive-jackson, you need to use JSON-B annotations. In this case, you would use javax.json.bind.annotation.JsonbTransient