From b986a0a38d52def8afbba1e6aaebba278c1c72e2 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Tue, 22 Dec 2015 14:33:33 -0800 Subject: [PATCH] Address decorability of role validation --- docs/src/design/proposals/Roles.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/src/design/proposals/Roles.md b/docs/src/design/proposals/Roles.md index 13742bec4f..6148d47566 100644 --- a/docs/src/design/proposals/Roles.md +++ b/docs/src/design/proposals/Roles.md @@ -34,10 +34,13 @@ services which can be applied to domain objects. [RegistrationOptions | + priority : number or string +]<:-[RoleOptions | + + validate : function (DomainObject) : boolean ] [Role. | + validate(domainObject : DomainObject) : boolean + + decorate(decoratorFn : function (T, V) : T, options? : RoleOptions) ]-:>[Factory.] [Factory.]-:>[Factory.] ``` @@ -90,6 +93,10 @@ mct.roles.persistenceRole.decorate(function (persistence, domainObject) { return domainObject.getModel().type === 'someType' ? new DifferentPersistence(domainObject) : persistence; +}, { + validate: function (domainObject, next) { + return domainObject.getModel().type === 'someType' || next(); + } }); ```