From 1fc9a3a9e464e712a46cdab5173a6386e8ba63e0 Mon Sep 17 00:00:00 2001 From: Clemens Vasters Date: Fri, 15 Feb 2019 16:56:02 +0100 Subject: [PATCH 1/2] Added datacontentencoding Signed-off-by: Clemens Vasters --- protobuf-format.md | 18 +++++++++--------- spec.json | 2 +- spec.md | 21 ++++++++++++++++++--- 3 files changed, 28 insertions(+), 13 deletions(-) diff --git a/protobuf-format.md b/protobuf-format.md index 63d4f2dfb..46261fd63 100644 --- a/protobuf-format.md +++ b/protobuf-format.md @@ -78,15 +78,15 @@ The CloudEvents type system MUST be mapped into the fields of `CloudEventAny` as follows: -| CloudEvents | CloudEventAny field -|--------------|------------------------------------------------------------- -| String | string_value -| Binary | binary_value -| URI | string_value (string expression conforming to URI-reference as defined in [RFC 3986 §4.1](https://tools.ietf.org/html/rfc3986#section-4.1)) -| Timestamp | string_value (string expression as defined in [RFC 3339](https://tools.ietf.org/html/rfc3339)) -| Map | map_value -| Integer | int_value -| Any | Not applicable. Any is the enclosing CloudEventAny message itself +| CloudEvents | CloudEventAny field +|---------------|------------------------------------------------------------- +| String | string_value +| Binary | binary_value +| URI-reference | string_value (string expression conforming to URI-reference as defined in [RFC 3986 §4.1](https://tools.ietf.org/html/rfc3986#section-4.1)) +| Timestamp | string_value (string expression as defined in [RFC 3339](https://tools.ietf.org/html/rfc3339)) +| Map | map_value +| Integer | int_value +| Any | Not applicable. Any is the enclosing CloudEventAny message itself Protocol Buffer representations of CloudEvents MUST use the media type `application/cloudevents+proto`. diff --git a/spec.json b/spec.json index a6b1c9d9c..954dd3f64 100644 --- a/spec.json +++ b/spec.json @@ -62,7 +62,7 @@ }, "schemaurl": { "type": "string", - "format": "uri" + "format": "uri-reference" }, "type": { "type": "string", diff --git a/spec.md b/spec.md index df58743e2..374aa2a6f 100644 --- a/spec.md +++ b/spec.md @@ -235,7 +235,7 @@ help intermediate gateways determine how to route the events. [RFC 3339](https://tools.ietf.org/html/rfc3339) ### schemaurl -* Type: `URI` +* Type: `URI-reference` * Description: A link to the schema that the `data` attribute adheres to. Incompatible changes to the schema SHOULD be reflected by a different URL. See @@ -243,8 +243,6 @@ help intermediate gateways determine how to route the events. for more information. * Constraints: * OPTIONAL - * If present, MUST adhere to the format specified in - [RFC 3986](https://tools.ietf.org/html/rfc3986) ### datacontenttype * Type: `String` per [RFC 2046](https://tools.ietf.org/html/rfc2046) @@ -276,6 +274,23 @@ help intermediate gateways determine how to route the events. [RFC 2046](https://tools.ietf.org/html/rfc2046) * For Media Type examples see [IANA Media Types](http://www.iana.org/assignments/media-types/media-types.xhtml) +### datacontentencoding +* Type: `String` per [RFC 2045 Section 6.1](https://tools.ietf.org/html/rfc2045#section-6.1) +* Description: Describes the content encoding for the `data` + attribute for when the `data` field MUST be encoded as a string, + like with structured transport binding modes using the JSON event + format, but the `datacontenttype` indicates a non-string media + type. When the `data` field's effective data type is not `String`, + this attribute MUST NOT be set and MUST be ignored when set. + + The "Base64" value for the Base64 encoding as defined in [RFC 2045 Section 6.8](https://tools.ietf.org/html/rfc2045#section-6.8) + MUST be supported. When set, the event-format-encoded value of the `data` + attribute is a base64 string, but the effective data type of + the `data` attribute towards the application is the base64-decoded + binary array. + + All other RFC2045 schemes are undefined for CloudEvents. + ## Data Attribute As defined by the term [Data](#data), CloudEvents MAY include domain-specific From 3137f866e891a461967b36e2113fad72d2c5de2e Mon Sep 17 00:00:00 2001 From: Clemens Vasters Date: Thu, 14 Mar 2019 08:18:13 -0700 Subject: [PATCH 2/2] adding constraints section Signed-off-by: Clemens Vasters --- spec.md | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/spec.md b/spec.md index 374aa2a6f..71584e191 100644 --- a/spec.md +++ b/spec.md @@ -276,21 +276,27 @@ help intermediate gateways determine how to route the events. ### datacontentencoding * Type: `String` per [RFC 2045 Section 6.1](https://tools.ietf.org/html/rfc2045#section-6.1) -* Description: Describes the content encoding for the `data` +* Description: Describes the content encoding for the `data` attribute for when the `data` field MUST be encoded as a string, - like with structured transport binding modes using the JSON event - format, but the `datacontenttype` indicates a non-string media + like with structured transport binding modes using the JSON event + format, but the `datacontenttype` indicates a non-string media type. When the `data` field's effective data type is not `String`, this attribute MUST NOT be set and MUST be ignored when set. The "Base64" value for the Base64 encoding as defined in [RFC 2045 Section 6.8](https://tools.ietf.org/html/rfc2045#section-6.8) MUST be supported. When set, the event-format-encoded value of the `data` - attribute is a base64 string, but the effective data type of + attribute is a base64 string, but the effective data type of the `data` attribute towards the application is the base64-decoded binary array. All other RFC2045 schemes are undefined for CloudEvents. +* Constraints: + * The attribute MUST be set if the `data` attribute contains string-encoded + binary data. Otherwise the attribute MUST NOT be set. + * If present, MUST adhere to [RFC 2045 Section 6.1](https://tools.ietf.org/html/rfc2045#section-6.1) + + ## Data Attribute As defined by the term [Data](#data), CloudEvents MAY include domain-specific