From 953c6b13bf707aa3cacf1b14302f1ce5420c8feb Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Thu, 17 Feb 2022 09:25:02 +0000 Subject: [PATCH] Fix issue with schema generation when datasource is undefined --- packages/builder/src/builderStore/dataBinding.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/builder/src/builderStore/dataBinding.js b/packages/builder/src/builderStore/dataBinding.js index db797bc743..edb12c7e74 100644 --- a/packages/builder/src/builderStore/dataBinding.js +++ b/packages/builder/src/builderStore/dataBinding.js @@ -536,11 +536,13 @@ export const getSchemaForDatasource = (asset, datasource, options) => { } // Add schema properties if required - if (addId) { - schema["_id"] = { type: "string" } - } - if (addRev) { - schema["_rev"] = { type: "string" } + if (schema) { + if (addId) { + schema["_id"] = { type: "string" } + } + if (addRev) { + schema["_rev"] = { type: "string" } + } } // Ensure there are "name" properties for all fields and that field schema