Test the SDK requirements spec

Signed-off-by: Fabio José <fabiojose@gmail.com>
This commit is contained in:
Fabio José 2019-07-29 11:11:04 -03:00
parent 462d019309
commit cf8f570730
2 changed files with 23 additions and 16 deletions

View File

@ -44,23 +44,23 @@ npm install cloudevents-sdk
These are the supported specifications by this version. These are the supported specifications by this version.
| **Specifications** | **v0.1** | **v0.2** | | **Specifications** | **v0.1** | **v0.2** | **v0.3** |
|---------------------------------------|----------|----------| |---------------------------------------|----------|----------|----------|
| CloudEvents | yes | yes | | CloudEvents | yes | yes | yes |
| HTTP Transport Binding - Structured | yes | yes | | HTTP Transport Binding - Structured | yes | yes | ?? |
| HTTP Transport Binding - Binary | yes | yes | | HTTP Transport Binding - Binary | yes | yes | ? |
| JSON Event Format | yes | yes | | JSON Event Format | yes | yes | ? |
### What we can do ### What we can do
| **What** | **v0.1** | **v0.2** | | **What** | **v0.1** | **v0.2** | **v0.3** |
|-------------------------------------|----------|----------| |-------------------------------------|----------|----------|----------|
| Create events | yes | yes | | Create events | yes | yes | yes |
| Emit Structured events over HTTP | yes | yes | | Emit Structured events over HTTP | yes | yes | ? |
| Emit Binary events over HTTP | yes | yes | | Emit Binary events over HTTP | yes | yes | ? |
| JSON Event Format | yes | yes | | JSON Event Format | yes | yes | ? |
| Receice Structured events over HTTP | no | yes | | Receice Structured events over HTTP | no | yes | ? |
| Receice Binary events over HTTP | no | yes | | Receice Binary events over HTTP | no | yes | ? |
## How to use ## How to use
@ -80,6 +80,8 @@ Cloudevent(spec, format);
```js ```js
var Cloudevent = require("cloudevents-sdk"); var Cloudevent = require("cloudevents-sdk");
var Spec02 = require("cloudevents-sdk/v02")
/* /*
* Constructs a default instance with: * Constructs a default instance with:
* - Spec 0.1 * - Spec 0.1
@ -95,8 +97,8 @@ cloudevent01
.source("urn:event:from:myapi/resourse/123"); .source("urn:event:from:myapi/resourse/123");
/* /*
* Backward compatibility to spec 0.1 by injecting methods from spec implementation * Backward compatibility to spec 0.1 by injecting methods from spec
* to Cloudevent * implementation to Cloudevent
*/ */
cloudevent01 cloudevent01
.eventTypeVersion("1.0"); .eventTypeVersion("1.0");

5
v02/index.js Normal file
View File

@ -0,0 +1,5 @@
const Spec = require("../lib/specs/spec_0_2.js");
module.exports = {
Spec
};