From 8d500584b2f3eda9d5dde475d0f5fcc0d10f4f0c Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Tue, 23 Feb 2021 10:06:55 +0000 Subject: [PATCH 1/2] allow empty params --- packages/server/src/api/routes/query.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/server/src/api/routes/query.js b/packages/server/src/api/routes/query.js index 4266cf6bdc..55223e4e9e 100644 --- a/packages/server/src/api/routes/query.js +++ b/packages/server/src/api/routes/query.js @@ -27,7 +27,7 @@ function generateQueryValidation() { readable: Joi.boolean(), parameters: Joi.array().items(Joi.object({ name: Joi.string(), - default: Joi.string() + default: Joi.string().allow(""), })), queryVerb: Joi.string().allow().required(), schema: Joi.object({}).required().unknown(true) From cdad198103178404ffe9d838d023a6ec4f441143 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Tue, 23 Feb 2021 10:41:11 +0000 Subject: [PATCH 2/2] ensure error is thrown on client validation failure --- packages/builder/src/builderStore/store/backend.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/builder/src/builderStore/store/backend.js b/packages/builder/src/builderStore/store/backend.js index 6731aea51c..0a5b9f0461 100644 --- a/packages/builder/src/builderStore/store/backend.js +++ b/packages/builder/src/builderStore/store/backend.js @@ -135,6 +135,9 @@ export const getBackendUiStore = () => { } query.datasourceId = datasourceId const response = await api.post(`/api/queries`, query) + if (response.status !== 200) { + throw new Error("Failed saving query.") + } const json = await response.json() store.update(state => { const currentIdx = state.queries.findIndex(