From 7d6a1e51f934a01eff5a2f415835467b5e82f8d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabio=20Jos=C3=A9?= Date: Fri, 9 Nov 2018 15:55:05 -0200 Subject: [PATCH] call for check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fabio José --- lib/cloudevent.js | 4 ++++ lib/specs/spec_0_2.js | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/lib/cloudevent.js b/lib/cloudevent.js index 973049c..d7214d2 100644 --- a/lib/cloudevent.js +++ b/lib/cloudevent.js @@ -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); } diff --git a/lib/specs/spec_0_2.js b/lib/specs/spec_0_2.js index de8fed8..01b53a8 100644 --- a/lib/specs/spec_0_2.js +++ b/lib/specs/spec_0_2.js @@ -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;