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

remove dataencoding and intro data_base64 in JSON #492

Merged
merged 5 commits into from
Sep 5, 2019

Conversation

clemensv
Copy link
Contributor

Alternate to #491

Clemens Vasters added 2 commits August 27, 2019 12:10
Signed-off-by: Clemens Vasters <clemensv@microsoft.com>
Signed-off-by: Clemens Vasters <clemensv@microsoft.com>
json-format.md Outdated
member name inside the JSON object MUST be `data`. For `Binary`, the value MUST
be represented as a [JSON string][json-string] expression containing the
[Base64][base64] encoded binary value, and the member name inside the JSON
object MUST be `data_base64`.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While it's implied, it doesn't actually ban someone from having both data and data_base64 in the JSON. Can we add something like:

Note, `data` and `data_base64` MUST NOT both appear at the same time within a CloudEvent serialization.

Someone may try to be "smart" and fill in both (when possible, like when it's a string) and that's a situation I think we need to avoid.

Also, could someone misinterpret the Binary usage here? I believe you mean that the data type of data is binary and you're not referring to the binary serialization of the CE. Perhaps:


For cases where data is a Binary value, it MUST be represented ....


Copy link
Contributor

@evankanderson evankanderson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Very nice!

json-format.md Outdated
@@ -92,9 +92,12 @@ respective CloudEvents type when the mapping rules are fulfilled.
### 2.3. Mapping Data
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Terrible nit, but I think this should be in section 3 now, because we've removed data from the attributes, and section 2 is "Attributes".

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would also put this text closer to the text in section 3.1 'Special Handling of "data"'.

@evankanderson
Copy link
Contributor

Does this also need to update spec.json?

@clemensv
Copy link
Contributor Author

clemensv commented Sep 3, 2019

I'll address @duglin and @evankanderson concerns tomorrow. I agree with all comments made.

Signed-off-by: Clemens Vasters <clemensv@microsoft.com>
@clemensv
Copy link
Contributor Author

clemensv commented Sep 4, 2019

I consolidated the data handling into section 3 of the JSON spec and also dropped rules we no longer need because we gave up on having "Map" as an option for data. What remains is the difference between binary and everything else. Strings are just another JSON value and need no special treatment. I also stressed that data and data_base64 are mutually exclusive.

Clemens Vasters added 2 commits September 4, 2019 09:21
Signed-off-by: Clemens Vasters <clemensv@microsoft.com>
Signed-off-by: Clemens Vasters <clemensv@microsoft.com>
@duglin
Copy link
Collaborator

duglin commented Sep 4, 2019

LGTM

@duglin
Copy link
Collaborator

duglin commented Sep 5, 2019

Approved on the Sept 5 call

@duglin duglin merged commit 2c13c10 into cloudevents:master Sep 5, 2019
evankanderson added a commit to evankanderson/spec that referenced this pull request Sep 10, 2019
Signed-off-by: Evan Anderson <evan.k.anderson@gmail.com>
evankanderson added a commit to evankanderson/spec that referenced this pull request Sep 11, 2019
duglin pushed a commit that referenced this pull request Sep 12, 2019
* Fix up JSON type mappings

Signed-off-by: Evan Anderson <evan.k.anderson@gmail.com>

* Fix type mapping for AMQP

Signed-off-by: Evan Anderson <evan.k.anderson@gmail.com>

* Add `data` to AMQP.

Signed-off-by: Evan Anderson <evan.k.anderson@gmail.com>

* Add payload data to amqp-format.md

Signed-off-by: Evan Anderson <evan.k.anderson@gmail.com>

* Update AMQP data encoding per discussion in #492

Signed-off-by: Evan Anderson <evan.k.anderson@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants