From 25cecd841af6d7770ca5864628db839b2b32d7d9 Mon Sep 17 00:00:00 2001 From: Scott Nichols Date: Wed, 3 Apr 2019 10:27:36 -0700 Subject: [PATCH 1/4] Atempting to resolve quote issue. Signed-off-by: Scott Nichols --- http-transport-binding.md | 49 ++++++++++++++++++++++++++++++--------- 1 file changed, 38 insertions(+), 11 deletions(-) diff --git a/http-transport-binding.md b/http-transport-binding.md index 7205d2423..9ca44d0d9 100644 --- a/http-transport-binding.md +++ b/http-transport-binding.md @@ -226,7 +226,10 @@ with [RFC7230, sections 3, 3.2, 3.2.6][rfc7230-section-3]. The rules for encoding of the percent character ('%') apply as defined in [RFC 3986 Section 2.4.][rfc3986-section-2-4]. -JSON objects and arrays are NOT surrounded with single or double quotes. +[JSON values][json-value] for well-known context attributes as defined by the +[CloudEvents specification][ce] or [CloudEvents Extensions][extensions] MAY omit +the surrounding single or double quote. All values are assumed to be a string +unless well-known. #### 3.1.4 Examples @@ -236,11 +239,11 @@ request: ```text POST /someresource HTTP/1.1 Host: webhook.example.com -ce-specversion: "0.2" -ce-type: "com.example.someevent" -ce-time: "2018-04-05T03:56:24Z" -ce-id: "1234-1234-1234" -ce-source: "/mycontext/subcontext" +ce-specversion: 0.2 +ce-type: com.example.someevent +ce-time: 2018-04-05T03:56:24Z +ce-id: 1234-1234-1234 +ce-source: /mycontext/subcontext .... further attributes ... Content-Type: application/json; charset=utf-8 Content-Length: nnnn @@ -254,11 +257,11 @@ This example shows a response containing an event: ```text HTTP/1.1 200 OK -ce-specversion: "0.2" -ce-type: "com.example.someevent" -ce-time: "2018-04-05T03:56:24Z" -ce-id: "1234-1234-1234" -ce-source: "/mycontext/subcontext" +ce-specversion: 0.2 +ce-type: com.example.someevent +ce-time: 2018-04-05T03:56:24Z +ce-id: 1234-1234-1234 +ce-source: /mycontext/subcontext .... further attributes ... Content-Type: application/json; charset=utf-8 Content-Length: nnnn @@ -268,6 +271,29 @@ Content-Length: nnnn } ``` +The following are equivalent in binary mode: + +```text +ce-specversion: 0.2 +ce-type: com.example.someevent +ce-custom: {"my":"value"} + .... further attributes ... +``` + +```text +ce-specversion: '0.2' +ce-type: 'com.example.someevent' +ce-custom: '{"my":"value"}' + .... further attributes ... +``` + +```text +ce-specversion: "0.2" +ce-type: "com.example.someevent" +ce-custom: "{\"my\":\"value\"}" + .... further attributes ... +``` + ### 3.2. Structured Content Mode The _structured_ content mode keeps event metadata and data together in the @@ -467,6 +493,7 @@ Content-Length: nnnn - [RFC7540][rfc7540] Hypertext Transfer Protocol Version 2 (HTTP/2) [ce]: ./spec.md +[extensions]: ./extensions/ [json-format]: ./json-format.md [json-batch-format]: ./json-format.md#4-json-batch-format [content-type]: https://tools.ietf.org/html/rfc7231#section-3.1.1.5 From 3c34416edae8dedf8de1e7ba1305c1352e247a4a Mon Sep 17 00:00:00 2001 From: Scott Nichols Date: Wed, 3 Apr 2019 10:27:36 -0700 Subject: [PATCH 2/4] Attempting to resolve quote issue. Signed-off-by: Scott Nichols --- http-transport-binding.md | 49 ++++++++++++++++++++++++++++++--------- 1 file changed, 38 insertions(+), 11 deletions(-) diff --git a/http-transport-binding.md b/http-transport-binding.md index 7205d2423..9ca44d0d9 100644 --- a/http-transport-binding.md +++ b/http-transport-binding.md @@ -226,7 +226,10 @@ with [RFC7230, sections 3, 3.2, 3.2.6][rfc7230-section-3]. The rules for encoding of the percent character ('%') apply as defined in [RFC 3986 Section 2.4.][rfc3986-section-2-4]. -JSON objects and arrays are NOT surrounded with single or double quotes. +[JSON values][json-value] for well-known context attributes as defined by the +[CloudEvents specification][ce] or [CloudEvents Extensions][extensions] MAY omit +the surrounding single or double quote. All values are assumed to be a string +unless well-known. #### 3.1.4 Examples @@ -236,11 +239,11 @@ request: ```text POST /someresource HTTP/1.1 Host: webhook.example.com -ce-specversion: "0.2" -ce-type: "com.example.someevent" -ce-time: "2018-04-05T03:56:24Z" -ce-id: "1234-1234-1234" -ce-source: "/mycontext/subcontext" +ce-specversion: 0.2 +ce-type: com.example.someevent +ce-time: 2018-04-05T03:56:24Z +ce-id: 1234-1234-1234 +ce-source: /mycontext/subcontext .... further attributes ... Content-Type: application/json; charset=utf-8 Content-Length: nnnn @@ -254,11 +257,11 @@ This example shows a response containing an event: ```text HTTP/1.1 200 OK -ce-specversion: "0.2" -ce-type: "com.example.someevent" -ce-time: "2018-04-05T03:56:24Z" -ce-id: "1234-1234-1234" -ce-source: "/mycontext/subcontext" +ce-specversion: 0.2 +ce-type: com.example.someevent +ce-time: 2018-04-05T03:56:24Z +ce-id: 1234-1234-1234 +ce-source: /mycontext/subcontext .... further attributes ... Content-Type: application/json; charset=utf-8 Content-Length: nnnn @@ -268,6 +271,29 @@ Content-Length: nnnn } ``` +The following are equivalent in binary mode: + +```text +ce-specversion: 0.2 +ce-type: com.example.someevent +ce-custom: {"my":"value"} + .... further attributes ... +``` + +```text +ce-specversion: '0.2' +ce-type: 'com.example.someevent' +ce-custom: '{"my":"value"}' + .... further attributes ... +``` + +```text +ce-specversion: "0.2" +ce-type: "com.example.someevent" +ce-custom: "{\"my\":\"value\"}" + .... further attributes ... +``` + ### 3.2. Structured Content Mode The _structured_ content mode keeps event metadata and data together in the @@ -467,6 +493,7 @@ Content-Length: nnnn - [RFC7540][rfc7540] Hypertext Transfer Protocol Version 2 (HTTP/2) [ce]: ./spec.md +[extensions]: ./extensions/ [json-format]: ./json-format.md [json-batch-format]: ./json-format.md#4-json-batch-format [content-type]: https://tools.ietf.org/html/rfc7231#section-3.1.1.5 From a0bb8fe0f081fbc686c24227b7f4ad872a032050 Mon Sep 17 00:00:00 2001 From: Scott Nichols Date: Tue, 30 Apr 2019 12:32:16 -0700 Subject: [PATCH 3/4] try no quotes. Signed-off-by: Scott Nichols --- amqp-format.md | 2 +- http-transport-binding.md | 30 +----------------------------- json-format.md | 12 ++++++------ 3 files changed, 8 insertions(+), 36 deletions(-) diff --git a/amqp-format.md b/amqp-format.md index 3dd1d79db..6bce1f571 100644 --- a/amqp-format.md +++ b/amqp-format.md @@ -56,7 +56,7 @@ exceptions noted below. | CloudEvents | AMQP | | ------------- | --------------------------- | | String | [string][amqp-string] | -| Integer | [long][amqp-long] | +| Integer | [string][amqp-string] | | Binary | [binary][amqp-binary] | | URI-reference | [string][amqp-string] | | Timestamp | [timestamp][amqp-timestamp] | diff --git a/http-transport-binding.md b/http-transport-binding.md index 933f80756..af44b2cca 100644 --- a/http-transport-binding.md +++ b/http-transport-binding.md @@ -207,7 +207,7 @@ specification, header names are case-insensitive. ##### 3.1.3.2 HTTP Header Values The value for each HTTP header is constructed from the respective attribute's -[JSON value][json-value] representation, compliant with the [JSON event +unquoted [JSON value][json-value] representation, compliant with the [JSON event format][json-format] specification. Some CloudEvents metadata attributes can contain arbitrary UTF-8 string content, @@ -226,11 +226,6 @@ with [RFC7230, sections 3, 3.2, 3.2.6][rfc7230-section-3]. The rules for encoding of the percent character ('%') apply as defined in [RFC 3986 Section 2.4.][rfc3986-section-2-4]. -[JSON values][json-value] for well-known context attributes as defined by the -[CloudEvents specification][ce] or [CloudEvents Extensions][extensions] MAY omit -the surrounding single or double quote. All values are assumed to be a string -unless well-known. - #### 3.1.4 Examples This example shows the _binary_ mode mapping of an event with an HTTP POST @@ -271,29 +266,6 @@ Content-Length: nnnn } ``` -The following are equivalent in binary mode: - -```text -ce-specversion: 0.2 -ce-type: com.example.someevent -ce-custom: {"my":"value"} - .... further attributes ... -``` - -```text -ce-specversion: '0.2' -ce-type: 'com.example.someevent' -ce-custom: '{"my":"value"}' - .... further attributes ... -``` - -```text -ce-specversion: "0.2" -ce-type: "com.example.someevent" -ce-custom: "{\"my\":\"value\"}" - .... further attributes ... -``` - ### 3.2. Structured Content Mode The _structured_ content mode keeps event metadata and data together in the diff --git a/json-format.md b/json-format.md index b954ff54e..4ab67b769 100644 --- a/json-format.md +++ b/json-format.md @@ -64,7 +64,7 @@ exceptions noted below. | CloudEvents | JSON | | ------------- | -------------------------------------------------------------- | | String | [string][json-string] | -| Integer | [number][json-number], only the `int` component is permitted | +| Integer | [string][json-string], interpreted as a [number][json-number] | | Binary | [string][json-string], [Base64-encoded][base64] binary | | URI-reference | [string][json-string] following [RFC 3986][rfc3986] | | Timestamp | [string][json-string] following [RFC 3339][rfc3339] (ISO 8601) | @@ -180,7 +180,7 @@ Example event with `String`-valued `data`: "time" : "2018-04-05T17:31:00Z", "comexampleextension1" : "value", "comexampleextension2" : { - "otherValue": 5 + "otherValue": "5" }, "datacontenttype" : "text/xml", "data" : "" @@ -198,7 +198,7 @@ Example event with `Binary`-valued data "time" : "2018-04-05T17:31:00Z", "comexampleextension1" : "value", "comexampleextension2" : { - "otherValue": 5 + "otherValue": "5" }, "datacontenttype" : "application/vnd.apache.thrift.binary", "data" : "... base64 encoded string ..." @@ -217,7 +217,7 @@ or [JSON data](#31-special-handling-of-the-data-attribute) data: "time" : "2018-04-05T17:31:00Z", "comexampleextension1" : "value", "comexampleextension2" : { - "otherValue": 5 + "otherValue": "5" }, "datacontenttype" : "application/json", "data" : { @@ -267,7 +267,7 @@ second with JSON data. "time" : "2018-04-05T17:31:00Z", "comexampleextension1" : "value", "comexampleextension2" : { - "otherValue": 5 + "otherValue": "5" }, "datacontenttype" : "application/vnd.apache.thrift.binary", "data" : "... base64 encoded string ..." @@ -280,7 +280,7 @@ second with JSON data. "time" : "2018-04-05T17:31:05Z", "comexampleextension1" : "value", "comexampleextension2" : { - "otherValue": 5 + "otherValue": "5" }, "datacontenttype" : "application/json", "data" : { From 0538aa3e47e2666e14861cbc0e5a763558ad4903 Mon Sep 17 00:00:00 2001 From: Scott Nichols Date: Tue, 30 Apr 2019 12:37:41 -0700 Subject: [PATCH 4/4] Quote json ints.: Signed-off-by: Scott Nichols --- amqp-transport-binding.md | 10 +++++----- spec.md | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/amqp-transport-binding.md b/amqp-transport-binding.md index 372528117..b13f5e2a8 100644 --- a/amqp-transport-binding.md +++ b/amqp-transport-binding.md @@ -201,11 +201,11 @@ content-type: application/json; charset=utf-8 ----------- application-properties ----------- -cloudEvents:specversion: "0.3-wip" -cloudEvents:type: "com.example.someevent" -cloudEvents:time: "2018-04-05T03:56:24Z" -cloudEvents:id: "1234-1234-1234" -cloudEvents:source: "/mycontext/subcontext" +cloudEvents:specversion: 0.3-wip +cloudEvents:type: com.example.someevent +cloudEvents:time: 2018-04-05T03:56:24Z +cloudEvents:id: 1234-1234-1234 +cloudEvents:source: /mycontext/subcontext .... further attributes ... ------------- application-data --------------- diff --git a/spec.md b/spec.md index 7f5d5b465..37b4e451b 100644 --- a/spec.md +++ b/spec.md @@ -411,7 +411,7 @@ The following example shows a CloudEvent serialized as JSON: "time" : "2018-04-05T17:31:00Z", "comexampleextension1" : "value", "comexampleextension2" : { - "othervalue": 5 + "othervalue": "5" }, "datacontenttype" : "text/xml", "data" : ""