Documentation about backward compatibility
Signed-off-by: Fabio José <fabiojose@gmail.com>
This commit is contained in:
parent
2ba9916153
commit
745e6845c6
22
README.md
22
README.md
|
|
@ -51,6 +51,20 @@ Javascript SDK for CloudEvents
|
|||
*/
|
||||
var cloudevent01 = new Cloudevent();
|
||||
|
||||
/*
|
||||
* Implemented using [Builder Design Pattern](https://en.wikipedia.org/wiki/Builder_pattern)
|
||||
*/
|
||||
cloudevent01
|
||||
.type("com.github.pull.create")
|
||||
.source("urn:event:from:myapi/resourse/123");
|
||||
|
||||
/*
|
||||
* Backward compatibility by injecting methods from spec implementation to `Cloudevent`
|
||||
* See how [here](lib/specs/spec_0_1.js#L17)
|
||||
*/
|
||||
cloudevent01
|
||||
.eventTypeVersion("1.0");
|
||||
|
||||
/*
|
||||
* Constructs an instance with:
|
||||
* - Spec 0.2
|
||||
|
|
@ -58,4 +72,12 @@ var cloudevent01 = new Cloudevent();
|
|||
*/
|
||||
var cloudevent02 = new Cloudevent(Cloudevent.specs['0.2']);
|
||||
|
||||
/*
|
||||
* Different specs, but the same API.
|
||||
*/
|
||||
cloudevent02
|
||||
.type("com.github.pull.create")
|
||||
.source("urn:event:from:myapi/resourse/123");
|
||||
|
||||
|
||||
```
|
||||
|
|
|
|||
|
|
@ -27,6 +27,13 @@ describe("CloudEvents Spec 0.1 - JavaScript SDK", () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe("Backward compatibility", () => {
|
||||
it("should have 'eventTypeVersion'", () => {
|
||||
cloudevent.eventTypeVersion("1.0");
|
||||
expect(cloudevent.format()).to.have.property('eventTypeVersion');
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue