Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The I-JSON option #80

Open
jansupol opened this issue Apr 22, 2018 · 7 comments
Open

The I-JSON option #80

jansupol opened this issue Apr 22, 2018 · 7 comments

Comments

@jansupol
Copy link
Owner

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:
OAI/OpenAPI-Specification#1519 (comment)

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.

@jansupol
Copy link
Owner Author

@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.

@jansupol
Copy link
Owner Author

@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.

@jansupol
Copy link
Owner Author

@jansupol
Copy link
Owner Author

@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.

@jansupol
Copy link
Owner Author

@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...

@jansupol
Copy link
Owner Author

@rmannibucau Commented
@cyberphone fully agree and I'm all for to deprecate it.

@jansupol
Copy link
Owner Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant