eclipse-ee4j / eclipse-ee4j/yasson

Deserialization in Yasson 3 is no more strict.

Open
#668 3 comments 0 reactions 1 assignee Claimed by @KyleAure View on GitHub
bug spec issue
Dominant language
Java
Stars
218
Forks
109
Avg merge
1d 5h
Merged PRs (30d)
9

Description

**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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.