@@ -58,8 +58,8 @@ exceptions noted below.
5858| String | [ string] [ JSON-String ]
5959| Integer | [ number] [ JSON-Number ] , only the ` int ` component is permitted
6060| Binary | [ string] [ JSON-String ] , [ Base64-encoded] [ base64 ] binary
61- | URI-reference | [ string] [ JSON-String ]
62- | Timestamp | [ string] [ JSON-String ]
61+ | URI-reference | [ string] [ JSON-String ] following [ RFC 3986 ] [ RFC3986 ]
62+ | Timestamp | [ string] [ JSON-String ] following [ RFC 3339 ] [ RFC3339 ] (ISO 8601)
6363| Map | [ JSON object] [ JSON-Object ]
6464| Any | [ JSON value] [ JSON-Value ]
6565
@@ -76,6 +76,11 @@ and any revision of such a specification, MUST also define explicit mapping
7676rules for all other event formats that are part of the CloudEvents core at
7777the time of the submission or revision.
7878
79+ If required, like when decoding Maps, the CloudEvents type can be determined
80+ by inference using the rules from the mapping table, whereby the only potentially
81+ ambiguous JSON data type is ` string ` . The value is compatible with the respective
82+ CloudEvents type when the mapping rules are fulfilled.
83+
7984### 2.3. Mapping Any-typed Attributes
8085
8186The CloudEvents ` data ` attribute is ` Any ` -typed, meaning that it holds a value
@@ -124,10 +129,10 @@ the [type system mapping](#22-type-system-mapping).
124129### 3.1. Special Handling of the "data" Attribute
125130
126131The mapping of the ` Any ` -typed ` data ` attribute follows the rules laid out
127- in [ Section 2.3.] ( #23-mapping-any-typed-attributes ) , with one additional
128- rule :
132+ in [ Section 2.3.] ( #23-mapping-any-typed-attributes ) , with two additional
133+ rules :
129134
130- If an implementation determines that the type of the ` data ` attribute is
135+ First, if an implementation determines that the type of the ` data ` attribute is
131136` Binary ` or ` String ` , it MUST inspect the ` contenttype ` attribute to determine
132137whether it is indicated that the data value contains JSON data.
133138
@@ -148,6 +153,13 @@ per the [type-system mapping](#22-type-system-mapping), the resulting `data`
148153member [ JSON value] [ JSON-Value ] is unrestricted, and MAY also contain numeric
149154and logical JSON types.
150155
156+ Second, whether a Base64-encoded string in the data attribute is treated
157+ as ` Binary ` or as a ` String ` is also determined by the ` contenttype ` value. If
158+ the ` contenttype ` media type is known to contain text, the data attribute value
159+ is not further interpreted and treated as a text string. Otherwise, it is decoded
160+ and treated as a binary value.
161+
162+
151163### 3.2. Examples
152164
153165Example event with ` String ` -valued ` data ` :
@@ -232,7 +244,9 @@ a `Map` or [JSON data](#31-special-handling-of-the-data-attribute) data:
232244[ JSON-Value ] : https://tools.ietf.org/html/rfc7159#section-3
233245[ RFC2046 ] : https://tools.ietf.org/html/rfc2046
234246[ RFC2119 ] : https://tools.ietf.org/html/rfc2119
247+ [ RFC3986 ] : https://tools.ietf.org/html/rfc3986
235248[ RFC4627 ] : https://tools.ietf.org/html/rfc4627
236249[ RFC4648 ] : https://tools.ietf.org/html/rfc4648
237250[ RFC6839 ] : https://tools.ietf.org/html/rfc6839#section-3.1
238251[ RFC8259 ] : https://tools.ietf.org/html/rfc8259
252+ [ RFC3339 ] : https://www.ietf.org/rfc/rfc3339.txt
0 commit comments