quarkusio/quarkus

@Patch Method doesn't work as expected when using Jackson + @Consumes(MediaType.APPLICATION_JSON_PATCH_JSON) or @Consumes("application/merge-patch+json")

Open

#33186 opened on May 7, 2023

View on GitHub
 (9 comments) (0 reactions) (0 assignees)Java (12,967 stars) (2,464 forks)batch import
area/resteasy-classicgood first issuekind/enhancement

Description

Describe the bug

As per the below documentation, I should be able to patch a resource using @Consumes(MediaType.APPLICATION_JSON_PATCH_JSON) or @Consumes("application/merge-patch+json") and a @GET method. This doesn't work when using quarkus-resteasy-jackson, only works with quarkus-reast-jsonb

https://docs.jboss.org/resteasy/docs/4.7.0.Final/userguide/html/JAX-RS_2.1_additions.html

This is not working since Quarkus 2.1.0.

Expected behavior

should receive a patched resource as a parameter to method annotated with @Patch

Actual behavior

doesn't receive a patched resource as a parameter to method annotated with @Patch

How to Reproduce?

    @GET
    @Path("/user/{id}")
    public UserProfile getUser(@PathParam("id") Integer id) {
        var user = new UserProfile();
        user.setName("name");
        return user;
    }

    @PATCH
    @Path("/user/{id}")
    @Consumes("application/merge-patch+json")
    public UserProfile patcherUser(@PathParam("id") Integer id, UserProfile user) {
            return user;
    }

Output of uname -a or ver

Darwin MacBook-Pro.local 21.6.0 Darwin Kernel Version 21.6.0: Mon Mar 20 21:32:30 PDT 2023; root:xnu-8020.240.18.700.8~2/RELEASE_X86_64 x86_64

Output of java -version

openjdk version "20" 2023-03-21 OpenJDK Runtime Environment Homebrew (build 20) OpenJDK 64-Bit Server VM Homebrew (build 20, mixed mode, sharing)

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.1.0 onwards

Build tool (ie. output of mvnw --version or gradlew --version)

No response

Additional information

This doesn't work when using quarkus-resteasy-jackson extention.

Either I need to include quarkus-resteasy-jsonb or resteasy.patchfilter.legacy=true when using quarkus-resteasy-jackson extention

Contributor guide