Skip to content

Deserialization in Yasson 3 is no more strict. #668

@thomas-fra

Description

@thomas-fra

Describe the bug
Deserialization in Yasson 3 is no more strict.
If I have a class with a long value and on the json, there is a double value, where deserializing the content, there is no more exception and the double value is truncated into the long variable.

To Reproduce

public class MyClass {
private Long lid;
}

    JsonbConfig config = new JsonbConfig().withFormatting(true).withStrictIJSON(true);
    Jsonb jsonb = JsonbBuilder.create(config);
    String json= "{ lid\":1254.5 }";
    myInstance = jsonb.fromJson(json, MyClass.class);
    Assert.fail("1254.5 Should not be allowed on lid - Long attribute");

Expected behavior
Having a JsonbException thrown

System information:

  • OS: Windows
  • Java Version: 17
  • Yasson Version: 3.0.4

Additional context
Happened when migrating from wilffly 26.1.3 to wildfly 35.0.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working right

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions