From 826ee2aca89ddab15d0c63dca2c88a8caa19d088 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Mon, 9 Oct 2017 09:19:47 +0200 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/model.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/model.js b/lib/model.js index f9a9173b..2ced78db 100644 --- a/lib/model.js +++ b/lib/model.js @@ -766,7 +766,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; var isStatic = scope.isStatic;