call for check

Signed-off-by: Fabio José <fabiojose@gmail.com>
This commit is contained in:
Fabio José 2018-11-09 15:55:05 -02:00
parent 1f2841d5bd
commit 7d6a1e51f9
2 changed files with 11 additions and 0 deletions

View File

@ -16,6 +16,10 @@ function Cloudevent(_spec, _formatter){
* To format the payload using the formatter
*/
Cloudevent.prototype.format = function(){
// Check the constraints
this.spec.check();
// Then, format
return this.formatter.format(this.spec.payload);
}

View File

@ -7,6 +7,13 @@ function Spec_0_2(){
};
}
/*
* Check the spec constraints.
*/
Spec_0_2.prototype.check = function(){
}
Spec_0_2.prototype.type = function(_type){
this.payload['type'] = _type;
return this;