Open jansupol opened 6 years ago
@cyberphone Commented I took the liberty researching the issue a bit further.
public class Dog {
public String name;
public int age;
public long ijsonlong; // Added test property
public boolean bitable;
}
Updated demo program:
dog.ijsonlong = 9223372036854775807l; // Largest long there is
JsonbConfig config = new JsonbConfig().withStrictIJSON(true);
Jsonb jsonb = JsonbBuilder.create(config);
String result = jsonb.toJson(dog);
System.out.println(result);
Result:
{"age":4,"bitable":false,"ijsonlong":9223372036854775807,"name":"Falco"}
This is (as far as I can tell...) not compliant with I-JSON.
@m0mus Commented Spec defines big double numbers behaviour in 3.16 as:
JSON Binding implementation MUST serialize/deserialize numbers that express greater magnitude
or precision than an IEEE 754 double precision number as strings.
I see that the same should be done for long numbers and BigInteger when I-JSON support is switched on. These numbers should be serialized as strings and JSON-B implementations must be responsible for proper handling of it.
@cyberphone Commented The Johnzon folks consider I-JSON a useless option and converted it into a no-op: https://github.com/apache/johnzon/blob/f9a916200233f8777addcbaf73807067aa7559f6/johnzon-jsonb/src/main/java/org/apache/johnzon/jsonb/JohnzonBuilder.java#L264
@rmannibucau Commented Well johnzon defaults already match MUST of I-JSON so the option is actually useless.
Important side note to avoid spec overlapping: serialization must NOT be handled by JSON-B but JSON-P here so it can be something to port to JSON-P attention.
@cyberphone Commented @rmannibucau This interpretation may be correct RFC-wise but it doesn't solve the interoperability problem. I see no justification for an option that does nothing...
@rmannibucau Commented @cyberphone fully agree and I'm all for to deprecate it.
Having an I-JSON option is great but since serialization of numbers outside of the IEEE-754 double precision universe isn't standardized it doesn't help that much: https://github.com/OAI/OpenAPI-Specification/issues/1519#issuecomment-377964659
BTW, does the I-JSON option really address serialization of
long
? If it doesn't then it is not really I-JSON compliant.A list of things affected by the I-JSON option would be much appreciated.