-
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
Serialization of binary data with no content type in JSON format #933
Comments
@jskeet just to make sure I'm following the scenario... are you talking about a CE that looks like:
If so, are you asking if the receiving SDK is supposed to treat the decoded "aGVsbG8gd29ybGQK" as json? I think the answer is "no" and the SDK shouldn't make any assumptions about it. It should treat it as an array of bytes. |
Nope, that's fine - it's only the data property. I expect I've just misremembered what was agreed, which would be great. Hopefully this can be cleared up really quickly in the meeting. |
Whoops - the above comment was written in a hurry, not noting that it's the wrong issue. (I was thinking of #934.) Yes, you've got it exactly right, and I agree - I think we should only default to application/json for structured events where |
We agreed to close this on the 2/17 meeting. @jskeet reopen if I got that wrong |
I'm trying to adjust the C# JSON serializers to take account of #861 and #881. I'm struggling on a couple of corner cases though, around binary data.
The JSON event format says that a serializer has to distinguish between binary data and non-binary data (to know which data property to populate) and also that the default content type (if otherwise unspecified) should be application/json. The placement of the defaulting (which was my own sentence!) is alongside the "not binary" case.
What does this mean for the structured mode encoded form of a CloudEvent with binary data but no data content type? Should a data content type of
application/json
be used anyway? Do we expect deserialization to cope with a JSON content type but binary data? (Just assume that the binary data is UTF-8-encoded text?)It's possible that this kind of corner case doesn't need to be handled the same way by every SDK, of course...
The text was updated successfully, but these errors were encountered: