-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
None
-
None
-
None
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.