Skip to content

Commit 5110ad4

Browse files
lancefabiojose
authored andcommitted
src,fix: drop support for v0.2 and clean up contenttype
This commit removes support for the v0.2 specification. It also removes the `contenttype` attribute from the `CloudEvent` object. While the HTTP protocol binding specifies that in binary mode, the `datacontenttype` attribute should map to the HTTP Content-Type header, that doesn't mean that the `CloudEvent` object should have a `contenttype` property. Fixes: #61 Fixes: #66 Signed-off-by: Lance Ball <[email protected]>
1 parent 1a4bdce commit 5110ad4

35 files changed

+201
-2492
lines changed

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ To see working examples, point to [examples](./examples).
3333

3434
## :newspaper: Newsletter :newspaper:
3535

36-
> all the API developed before, for 0.1, 0.2 and 0.3, works as the same.
36+
> all the API developed before, for 0.1 and 0.3, works as the same.
3737
3838
Checkout the new expressive additions.
3939

@@ -91,21 +91,21 @@ These are the supported specifications by this version.
9191

9292
| **Specifications** | v0.1 | v0.2 | v0.3 | **v1.0** |
9393
|---------------------------------------|------|------|------|----------|
94-
| CloudEvents | yes | yes | yes | yes |
95-
| HTTP Transport Binding - Structured | yes | yes | yes | yes |
96-
| HTTP Transport Binding - Binary | yes | yes | yes | yes |
97-
| JSON Event Format | yes | yes | yes | yes |
94+
| CloudEvents | no | no | yes | yes |
95+
| HTTP Transport Binding - Structured | no | no | yes | yes |
96+
| HTTP Transport Binding - Binary | no | no | yes | yes |
97+
| JSON Event Format | no | no | yes | yes |
9898

9999
### What we can do
100100

101101
| **What** | v0.1 | v0.2 | v0.3 | **v1.0** |
102102
|-------------------------------------|--------|------|------|----------|
103-
| Create events | yes | yes | yes | yes |
104-
| Emit Structured events over HTTP | yes | yes | yes | yes |
105-
| Emit Binary events over HTTP | yes | yes | yes | yes |
106-
| JSON Event Format | yes | yes | yes | yes |
107-
| Receive Structured events over HTTP | **no** | yes | yes | yes |
108-
| Receive Binary events over HTTP | **no** | yes | yes | yes |
103+
| Create events | no | no | yes | yes |
104+
| Emit Structured events over HTTP | no | no | yes | yes |
105+
| Emit Binary events over HTTP | no | no | yes | yes |
106+
| JSON Event Format | no | no | yes | yes |
107+
| Receive Structured events over HTTP | **no** | no | yes | yes |
108+
| Receive Binary events over HTTP | **no** | no | yes | yes |
109109

110110
## How to use
111111

examples/express-ex/README.md

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -161,61 +161,3 @@ __A Batch One__
161161

162162
TODO
163163

164-
## Spec v0.2
165-
166-
### How To Post an Event
167-
168-
__A Structured One__
169-
170-
> Payload [example](../payload/v02/structured-event-0.json)
171-
172-
```bash
173-
curl -X POST \
174-
-d'@../payload/v02/structured-event-0.json' \
175-
-H'Content-Type:application/cloudevents+json' \
176-
http://localhost:3000/v02
177-
```
178-
179-
__A Structured One with Extension__
180-
181-
> Payload [example](../payload/v02/structured-event-1.json)
182-
183-
```bash
184-
curl -X POST \
185-
-d'@../payload/v02/structured-event-1.json' \
186-
-H'Content-Type:application/cloudevents+json' \
187-
http://localhost:3000/v02
188-
```
189-
190-
__A Binary One__
191-
192-
```bash
193-
curl -X POST \
194-
-d'@../payload/data-0.json' \
195-
-H'Content-Type:application/json' \
196-
-H'ce-specversion:0.2' \
197-
-H'ce-type:com.github.pull.create' \
198-
-H'ce-source:https://github.com/cloudevents/spec/pull/123' \
199-
-H'ce-id:45c83279-c8a1-4db6-a703-b3768db93887' \
200-
-H'ce-time:2019-06-21T17:31:00Z' \
201-
http://localhost:3000/v02
202-
```
203-
204-
__A Binary One with Extension__
205-
206-
```bash
207-
curl -X POST \
208-
-d'@../payload/data-0.json' \
209-
-H'Content-Type:application/json' \
210-
-H'ce-specversion:0.2' \
211-
-H'ce-type:com.github.pull.create' \
212-
-H'ce-source:https://github.com/cloudevents/spec/pull/123' \
213-
-H'ce-id:45c83279-c8a1-4db6-a703-b3768db93887' \
214-
-H'ce-time:2019-06-21T17:31:00Z' \
215-
-H'ce-my-extension:extension value' \
216-
http://localhost:3000/v02
217-
```
218-
219-
__A Batch One__
220-
221-
TODO

examples/express-ex/index.js

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ const app = express();
66
const v03 = require("cloudevents-sdk/v03");
77
const unmarshaller03 = new v03.HTTPUnmarshaller();
88

9-
const v02 = require("cloudevents-sdk/v02");
10-
const unmarshaller02 = new v02.HTTPUnmarshaller();
11-
129
const v1 = require("cloudevents-sdk/v1");
1310
const structured1 = new v1.StructuredHTTPReceiver();
1411
const binary1 = new v1.BinaryHTTPReceiver();
@@ -88,27 +85,6 @@ app.post("/v03", function(req, res) {
8885
});
8986
});
9087

91-
app.post("/v02", function(req, res) {
92-
console.log(req.headers);
93-
console.log(req.body);
94-
95-
unmarshaller02.unmarshall(req.body, req.headers)
96-
.then((cloudevent) => {
97-
// pretty print
98-
console.log("Accepted event:");
99-
console.log(JSON.stringify(cloudevent.format(), null, 2));
100-
101-
res.status(201)
102-
.json(cloudevent.format());
103-
})
104-
.catch((err) => {
105-
console.error(err);
106-
res.status(415)
107-
.header("Content-Type", "application/json")
108-
.send(JSON.stringify(err));
109-
});
110-
});
111-
11288
app.listen(3000, function() {
11389
console.log("Example app listening on port 3000!");
11490
});

examples/payload/v02/structured-event-0.json

Lines changed: 0 additions & 11 deletions
This file was deleted.

examples/payload/v02/structured-event-1.json

Lines changed: 0 additions & 14 deletions
This file was deleted.

ext/spec_0_2.json

Lines changed: 0 additions & 81 deletions
This file was deleted.

http/unmarshaller/v02.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

lib/bindings/http/constants.js

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ module.exports = {
33
HEADERS: "headers",
44
CHARSET_DEFAULT: "utf-8",
55

6-
SPEC_V02: "0.2",
76
SPEC_V03: "0.3",
87
SPEC_V1: "1.0",
98

@@ -23,26 +22,6 @@ module.exports = {
2322
DEFAULT_CONTENT_TYPE: "application/json; charset=utf-8",
2423
DEFAULT_CE_CONTENT_TYPE: "application/cloudevents+json; charset=utf-8",
2524

26-
BINARY_HEADERS_02: {
27-
TYPE: "ce-type",
28-
SPEC_VERSION: "ce-specversion",
29-
SOURCE: "ce-source",
30-
ID: "ce-id",
31-
TIME: "ce-time",
32-
SCHEMA_URL: "ce-schemaurl",
33-
EXTENSIONS_PREFIX: "ce-"
34-
},
35-
STRUCTURED_ATTRS_02: {
36-
TYPE: "type",
37-
SPEC_VERSION: "specversion",
38-
SOURCE: "source",
39-
ID: "id",
40-
TIME: "time",
41-
SCHEMA_URL: "schemaurl",
42-
CONTENT_TYPE: "contenttype",
43-
DATA: "data"
44-
},
45-
4625
BINARY_HEADERS_03: {
4726
TYPE: "ce-type",
4827
SPEC_VERSION: "ce-specversion",

lib/bindings/http/emitter_binary_0_1.js

Lines changed: 0 additions & 91 deletions
This file was deleted.

0 commit comments

Comments
 (0)