From 0f6848442c2e910664b01876014d353222f99eec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabio=20Jos=C3=A9?= Date: Wed, 24 Oct 2018 15:43:03 -0300 Subject: [PATCH 1/3] Update spec.md Some improvements in the event serialized as JSON. --- spec.md | 51 +++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 47 insertions(+), 4 deletions(-) diff --git a/spec.md b/spec.md index eb5b66869..3111e4a80 100644 --- a/spec.md +++ b/spec.md @@ -271,15 +271,57 @@ encapsulated within the `data` attribute. * Constraints: * OPTIONAL -# Example +# Examples -The following example shows a CloudEvent serialized as JSON: +The following examples shows CloudEvent serialized as JSON. + +## Using relative URI in `source` element + +As defined in [RFC 3986, Section 4.2](https://tools.ietf.org/html/rfc3986#section-4.2) it is possible to use relative paths to express URI, but this require the apply of resolution algorithm [RFC 3986, Section 5](https://tools.ietf.org/html/rfc3986#section-5). + +``` JSON +{ + "cloudEventsVersion" : "0.1", + "eventType" : "com.github.pull.create", + "source" : "/cloudevents/spec/pull/123", + "eventID" : "A234-1234-1234", + "eventTime" : "2018-04-05T17:31:00Z", + "comExampleExtension1" : "value", + "comExampleExtension2" : { + "otherValue": 5 + }, + "contentType" : "text/xml", + "data" : "" +} +``` + +Regarding the resolution algorithm, lets consider: + +``` +- base URI = http://github.com +- source = /cloudevents/spec/pull/123 +``` + +The full URI will resoluted as: + +``` +full URI = base URI + source +``` + +Then, the full URI will be: + +``` +https://github.com/cloudevents/spec/pull/123 +``` +> See another example [here](https://docs.microsoft.com/en-us/azure/event-grid/cloudevents-schema#cloudevent-schema) + +## Using full URI in `source` element ``` JSON { "cloudEventsVersion" : "0.1", - "eventType" : "com.example.someevent", - "source" : "/mycontext", + "eventType" : "com.github.pull.create", + "source" : "https://github.com/cloudevents/spec/pull/123", "eventID" : "A234-1234-1234", "eventTime" : "2018-04-05T17:31:00Z", "comExampleExtension1" : "value", @@ -290,3 +332,4 @@ The following example shows a CloudEvent serialized as JSON: "data" : "" } ``` + From 9e7784d5adfa5dbad82b70f9d1e625ef8c6200d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabio=20Jos=C3=A9?= Date: Wed, 24 Oct 2018 16:25:04 -0300 Subject: [PATCH 2/3] Fix the Example section MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fabio José --- spec.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec.md b/spec.md index 3111e4a80..3455ee6de 100644 --- a/spec.md +++ b/spec.md @@ -271,7 +271,7 @@ encapsulated within the `data` attribute. * Constraints: * OPTIONAL -# Examples +# Example The following examples shows CloudEvent serialized as JSON. From 3357a05e4104b9a15d4a6157b7bfca44a04be812 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabio=20Jos=C3=A9?= Date: Wed, 24 Oct 2018 16:29:52 -0300 Subject: [PATCH 3/3] Fix the Signed-off-by MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fabio José --- spec.md | 42 ------------------------------------------ 1 file changed, 42 deletions(-) diff --git a/spec.md b/spec.md index 3455ee6de..f093292d5 100644 --- a/spec.md +++ b/spec.md @@ -275,48 +275,6 @@ encapsulated within the `data` attribute. The following examples shows CloudEvent serialized as JSON. -## Using relative URI in `source` element - -As defined in [RFC 3986, Section 4.2](https://tools.ietf.org/html/rfc3986#section-4.2) it is possible to use relative paths to express URI, but this require the apply of resolution algorithm [RFC 3986, Section 5](https://tools.ietf.org/html/rfc3986#section-5). - -``` JSON -{ - "cloudEventsVersion" : "0.1", - "eventType" : "com.github.pull.create", - "source" : "/cloudevents/spec/pull/123", - "eventID" : "A234-1234-1234", - "eventTime" : "2018-04-05T17:31:00Z", - "comExampleExtension1" : "value", - "comExampleExtension2" : { - "otherValue": 5 - }, - "contentType" : "text/xml", - "data" : "" -} -``` - -Regarding the resolution algorithm, lets consider: - -``` -- base URI = http://github.com -- source = /cloudevents/spec/pull/123 -``` - -The full URI will resoluted as: - -``` -full URI = base URI + source -``` - -Then, the full URI will be: - -``` -https://github.com/cloudevents/spec/pull/123 -``` -> See another example [here](https://docs.microsoft.com/en-us/azure/event-grid/cloudevents-schema#cloudevent-schema) - -## Using full URI in `source` element - ``` JSON { "cloudEventsVersion" : "0.1",