From 16ede97033a967cff2a7f8642d3c86c1a33a1214 Mon Sep 17 00:00:00 2001 From: Kevin Delisle Date: Wed, 23 Aug 2017 10:21:11 -0400 Subject: [PATCH] Handle missing getUpdateOnlyProperties fn If the current scope does not define a getUpdateOnlyProperties function, the updateOnlyProps value will now be set to false. --- lib/persisted-model.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/persisted-model.js b/lib/persisted-model.js index de676a6d..10ff0591 100644 --- a/lib/persisted-model.js +++ b/lib/persisted-model.js @@ -630,7 +630,8 @@ module.exports = function(registry) { // if there is atleast one updateOnly property, then we set // createOnlyInstance flag in __create__ to indicate loopback-swagger // code to create a separate model instance for create operation only - const updateOnlyProps = this.getUpdateOnlyProperties(); + const updateOnlyProps = this.getUpdateOnlyProperties ? + this.getUpdateOnlyProperties() : false; const hasUpdateOnlyProps = updateOnlyProps && updateOnlyProps.length > 0; // This is just for LB 3.x