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

Agree on handling of JSON value types #52

Closed
mattheworiordan opened this issue May 12, 2015 · 7 comments · Fixed by #53
Closed

Agree on handling of JSON value types #52

mattheworiordan opened this issue May 12, 2015 · 7 comments · Fixed by #53
Labels
enhancement New feature or improved functionality.

Comments

@mattheworiordan
Copy link
Member

Creating this issue to cover the discussion at #51

Probably better if we continue the discussion here as an issue

@mattheworiordan mattheworiordan added the enhancement New feature or improved functionality. label May 12, 2015
@paddybyers
Copy link
Member

Copying my comment from there:

OK, you're right, the RFC is explicit: "JSON text is a serialized object or array"

http://www.ietf.org/rfc/rfc4627.txt

By contrast, the ECMA spec permits any text that satisfies the grammar for a JSON value (which does include primitives):

http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf

So I agree remove support for primitives.

@mattheworiordan
Copy link
Member Author

Ok, so do we explicitly reject data that is not a supported type, or allow it but then let the developer deal with the possible crash on the other end. I think we should explicitly reject unsupported types so that we can guarantee type portability between all client libraries.

@paddybyers
Copy link
Member

Yes, on balance I think it should be rejected.

@paddybyers
Copy link
Member

.. but then there is the issue of how we claim to police the supplied values. For example, NaN can't be represented in JSON - so do we check for those as well?

@mattheworiordan
Copy link
Member Author

Nope, I think it is acceptable that we support String, Binary (ByteArray), and JSON Array / Objects. If you have a value in there that the native serialiser accepts, such as NaN becoming null then I think that is acceptable and something the developer should be able to figure out themselves given we say we support JSON.

@paddybyers
Copy link
Member

ok, agreed

@mattheworiordan
Copy link
Member Author

Please see ably/ably-ruby#48 where I have implemented this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or improved functionality.
Development

Successfully merging a pull request may close this issue.

2 participants