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

Support number, boolean #78

Open
evert opened this issue Jun 16, 2021 · 1 comment
Open

Support number, boolean #78

evert opened this issue Jun 16, 2021 · 1 comment

Comments

@evert
Copy link

evert commented Jun 16, 2021

Might as well open a ticket for this, as it's something that was discussed in various other threads.

I think it would be great if we can explicitly encode numbers and booleans as numbers and booleans when encoding to application/json, including having the ability to encode 'an array of numbers or booleans' for the "multiple" cases.

@mamund
Copy link
Owner

mamund commented Jun 16, 2021

as far as i can tell, this will be a breaking change, right?

i've resisted "strong-typing" the message to reduce rejected responses (e.g. the receiver was expecting a boolean and got a number instead). the safest solution is to marshall data as strings and let the receiver do whatever type-casting is required.

i've worked w/ cases where the type information is sent along with the string ({value:"13",type:"currency"}). that's a more complicated solution but it has the advantage of backward compatibility and reduces (doesn't eliminate) type-casting bugs.

thoughts?

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

2 participants