-
Notifications
You must be signed in to change notification settings - Fork 582
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
Revisiting JSON format's data member #934
Comments
From the spec, I see this example:
And from that I would conclude that if |
comexampleothervalue is just an extension attribute - that's fine. If we could talk about this on Thursday, someone else at remember the same bit as me about "only a string or object for data". If I'm just misremembering, that would make my life easier :) |
Another way I look at it is this: any valid/stand-alone JSON should be able to be a child of |
I still think the spec is pretty clear ... When we're talking about data then any JSONValue is valid .. so all of these are good: When we're talking about CE attributes then only a subset of types are available.. Appropriate Not Appropriate The above is NOT valid according to the JSON Format specification, or indeed the general CloudEvent specification. My argument is that this should either be ignored by SDKs, or coerced into an extension attribute with a type of |
I agree, although I still think an example makes it even clearer. (I seem to remember I have an action item to add another example in #950.) [decimal extension value]
I'd suggest that if something isn't valid, it should cause an error rather than being ignored or coerced. (I think that's what the C# SDK does, but I now want to add a test for it...) Would welcome talking about that more. As a corner case, what about "intextension": 10.00 ? I think I'd want to interpret that as a value of 10... but I could probably be persuaded that the ".00" suggests it's expected to be handled as a non-integer value, and should behave the same was as 3.142... |
We agreed to close this on the 2/17 meeting. @jskeet reopen if I got that wrong |
I'm back to implementing #861, and I've run into this:
I have a memory that the value of
data
must be a JSON string or object, not an array, number or Boolean value. However, I don't see any indication of that within the spec. The JSON value reference includes numbers, Boolean values, arrays and indeed null.So if an SDK is provided CloudEvent data of "the number 1.5" and a content type of application/json (explicitly or implicitly), is it reasonable for the structured event representation to be:
? If that's valid, then my life will be easier but my memory is incorrect. If it's invalid, then is that already covered somewhere in the spec and I just haven't seen it, or do we need to change the spec?
The text was updated successfully, but these errors were encountered: