Rethink Versioning
See original GitHub issueWhen a developer wants to use CloudEvents, they think about an event, not which version they’re using. The way this module is written is highly segmented towards the version of CloudEvent.
Rather than this:
const v1 = require("cloudevents-sdk/v1");
Where const v1
doesn’t make much sense.
We should have
const CloudEvents = require("cloudevents-sdk");
It should be easy to create a CloudEvent:
let myevent= new CloudEvent({
specversion: '1.0',
source: '/source',
type: 'type',
dataContentType: 'text/plain',
dataschema: 'http://d.schema.com/my.json',
subject: 'cha.json',
data: 'my-data',
addExtension: ["my-ext", "0x600"]
});
let myevent2= new CloudEvent({
specversion: '0.3',
source: '/source',
type: 'type',
dataContentType: 'text/plain',
dataschema: 'http://d.schema.com/my.json',
subject: 'cha.json',
data: 'my-data',
addExtension: ["my-ext", "0x600"]
});
We should remove the v03
and v1
folders in the repo and just have one CloudEvent
that can support multiple versions.
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (9 by maintainers)
Top Results From Across the Web
Downloads - Rethink DNS
Rethink DNS + Firewall is a free and open source project, released under Apache License, Version 2.0. iOS? A lot of our users...
Read more >rethinking package - RDocumentation
This R package accompanies a course and book on Bayesian data analysis (McElreath 2016. Statistical Rethinking. CRC Press.). It contains tools ...
Read more >RethinkDB: the open-source database for the realtime web
When your app polls for data, it becomes slow, unscalable, and cumbersome to maintain. RethinkDB is the open-source, scalable database that makes building ......
Read more >ReThink - Steam Community
ReThink. 27. 3. Game won't launch at all on new version, and old version crashes within a ... ReThink 100% - All puzzles,...
Read more >"Rachael Ray" Rethink Your Ink/Rethink Your Status Update (TV ...
Rethink Your Ink/Rethink Your Status Update (2013). Alternate Versions (0). It looks like there are no Alternate Versions for this title.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
That’s in some ways what this pull request that landed yesterday was about.
And you can see the
HTTPReceiver
usage in the test here: https://github.com/cloudevents/sdk-javascript/blob/master/test/bindings/http/promiscuous_receiver_test.js#L13Once a
CloudEvent
has been created, that instance cannot be changed to a different version by just setting thespecversion
property. You can see here, that was a conscious choice by @fabiojose and I think it makes sense. Converting from one specification version to another is more than just changing the version number.With the changes that landed yesterday, when a
CloudEvent
is created using the constructor from the top level default export, it’s defaulting to an event conforming to the 1.0 spec. You can create a 0.3 event by reaching down into thev3
exports as before.I think your direct object notation could be a nice change. But that’s already covered by https://github.com/cloudevents/sdk-javascript/issues/65 isn’t it?
Closing this, as I think we have come to resolution. If not, feel free to reopen and we can discuss further.