Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-3132

The StudentPatchTest.testPatchDisabled test has different behavior with different versions of Yasson

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • None
    • None
    • None
    • None

    Description

      The StudentPatchTest.testPatchDisabled fails on Yasson 3.0.0. The test part the fails looks like this:

      jakarta.json.JsonArray patchRequest = Json.createArrayBuilder()
              .add(Json.createObjectBuilder().add("op", "copy").add("from", "/firstName").add("path", "/lastName").build())
              .add(Json.createObjectBuilder().add("op", "replace").add("path", "/firstName").add("value", "John").build())
              .build();
      Response res = patchTarget.request().build(HttpMethod.PATCH, Entity.entity(patchRequest, MediaType.APPLICATION_JSON_PATCH_JSON)).invoke();
      Assert.assertEquals("Http 400 is expected", 400, res.getStatus());
      

      On Yasson 2.x it throws the following exception which is the cause of the 400.

      jakarta.ws.rs.ProcessingException: RESTEASY008200: JSON Binding deserialization error: jakarta.json.bind.JsonbException: Can't deserialize JSON array into: class org.jboss.resteasy.test.resource.patch.Student
      

      The entity value for the above exception is:

      [{"op":"copy","from":"/firstName","path":"/lastName"},{"op":"replace","path":"/firstName","value":"John"}]
      

      With WildFly 27 where Yasson is 3.0, the result is a 200 with an empty entity {}. The difference needs to be examined. Yasson creates a new Student with all null values.

      Attachments

        Activity

          People

            Unassigned Unassigned
            jperkins-rhn James Perkins
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: