diff --git a/README.md b/README.md index 0431451..a4656ce 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,9 @@ String Cloudevent.toString() ``` -## `Formatter` class +## `Formatter` classes + +Every formatter class must implement these methods to work properly. ```js @@ -86,6 +88,19 @@ String Formatter.toString(payload) ``` +## `Spec` classes + +Every Spec class must implement these methods to work properly. + +```js + +/* + * Check the spec constraints, throwing an error if do not pass. + */ +Spec.check() + +``` + # How to use The `Cloudevent` constructor arguments. diff --git a/lib/specs/spec_0_1.js b/lib/specs/spec_0_1.js index 3b4e657..3d87770 100644 --- a/lib/specs/spec_0_1.js +++ b/lib/specs/spec_0_1.js @@ -19,6 +19,15 @@ function Spec_0_1(_caller){ } } +/* + * Check the constraints. + * + * throw an error if do not pass. + */ +Spec_0_1.prototype.check = function() { + +} + Spec_0_1.prototype.type = function(_type){ this.payload['eventType'] = _type; return this;