Strip hidden fields from viewV2 schema in client lib

This commit is contained in:
Andrew Kingston 2023-08-09 16:30:27 +01:00
parent 08b348c1d4
commit 7a40ad66c6
1 changed files with 9 additions and 0 deletions

View File

@ -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)