From 7a40ad66c6f9bcc322535cce6f0552b33bcc8458 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Wed, 9 Aug 2023 16:30:27 +0100 Subject: [PATCH] Strip hidden fields from viewV2 schema in client lib --- packages/client/src/utils/schema.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/client/src/utils/schema.js b/packages/client/src/utils/schema.js index 800e9b9be1..f20e724a6e 100644 --- a/packages/client/src/utils/schema.js +++ b/packages/client/src/utils/schema.js @@ -51,6 +51,15 @@ export const fetchDatasourceSchema = async ( return null } + // Strip hidden fields from views + if (datasource.type === "viewV2") { + Object.keys(schema).forEach(field => { + if (!schema[field].visible) { + delete schema[field] + } + }) + } + // Enrich schema with relationships if required if (definition?.sql && options?.enrichRelationships) { const relationshipAdditions = await getRelationshipSchemaAdditions(schema)