From d5beba079e09639fd8c7dcb6a8cb86c2a6783a2e Mon Sep 17 00:00:00 2001 From: dave-connors-3 <73915542+dave-connors-3@users.noreply.github.com> Date: Tue, 31 Oct 2023 20:24:12 -0500 Subject: [PATCH] Node color (#99) * update schemas with ref for node color * add validity tests * update default schema too --- schemas/1.5/dbt_yml_files-1.5.json | 55 +++++++++++++----------------- schemas/1.6/dbt_yml_files-1.6.json | 53 ++++++++++++---------------- schemas/dbt_yml_files.json | 53 ++++++++++++---------------- tests/1.5/valid/dbt_yml_files.yml | 3 ++ tests/1.6/valid/dbt_yml_files.yml | 3 ++ 5 files changed, 73 insertions(+), 94 deletions(-) diff --git a/schemas/1.5/dbt_yml_files-1.5.json b/schemas/1.5/dbt_yml_files-1.5.json index c7cb578..6e18d77 100644 --- a/schemas/1.5/dbt_yml_files-1.5.json +++ b/schemas/1.5/dbt_yml_files-1.5.json @@ -48,13 +48,7 @@ "type": "string" }, "docs": { - "type": "object", - "required": ["show"], - "properties": { - "show": { - "type": "boolean" - } - } + "$ref": "#/$defs/docs_config" }, "group": { "$ref": "#/$defs/group" @@ -176,13 +170,8 @@ "type": "string" }, "docs": { - "type": "object", - "properties": { - "show": { - "type": "boolean" - } - } - } + "$ref": "#/$defs/docs_config" + } }, "additionalProperties": false } @@ -324,12 +313,7 @@ "type": "string" }, "docs": { - "type": "object", - "properties": { - "show": { - "type": "boolean" - } - } + "$ref": "#/$defs/docs_config" }, "group": { "$ref": "#/$defs/group" @@ -420,12 +404,7 @@ "type": "string" }, "docs": { - "type": "object", - "properties": { - "show": { - "type": "boolean" - } - } + "$ref": "#/$defs/docs_config" }, "group": { "$ref": "#/$defs/group" @@ -506,12 +485,7 @@ "type": "string" }, "docs": { - "type": "object", - "properties": { - "show": { - "type": "boolean" - } - } + "$ref": "#/$defs/docs_config" }, "group": { "$ref": "#/$defs/group" @@ -755,6 +729,23 @@ } } }, + "docs_config": { + "title": "Docs config", + "type": "object", + "description": "Configurations for the appearance of nodes in the dbt documentation.", + "properties": { + "node_color": { + "type": "string", + "description": "The color of the node on the DAG in the documentation. It must be an Hex code or a valid CSS color name.", + "pattern": "^(#[a-fA-F0-9]{3}|#[a-fA-F0-9]{6}|[^#][a-zA-Z]*)$" + }, + "show": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, "freshness_definition": { "default": { "warn_after": { diff --git a/schemas/1.6/dbt_yml_files-1.6.json b/schemas/1.6/dbt_yml_files-1.6.json index 91a5e1e..f728f63 100644 --- a/schemas/1.6/dbt_yml_files-1.6.json +++ b/schemas/1.6/dbt_yml_files-1.6.json @@ -48,13 +48,7 @@ "type": "string" }, "docs": { - "type": "object", - "required": ["show"], - "properties": { - "show": { - "type": "boolean" - } - } + "$ref": "#/$defs/docs_config" }, "group": { "$ref": "#/$defs/group" @@ -176,12 +170,7 @@ "type": "string" }, "docs": { - "type": "object", - "properties": { - "show": { - "type": "boolean" - } - } + "$ref": "#/$defs/docs_config" } }, "additionalProperties": false @@ -257,12 +246,7 @@ "type": "string" }, "docs": { - "type": "object", - "properties": { - "show": { - "type": "boolean" - } - } + "$ref": "#/$defs/docs_config" }, "group": { "$ref": "#/$defs/group" @@ -353,12 +337,7 @@ "type": "string" }, "docs": { - "type": "object", - "properties": { - "show": { - "type": "boolean" - } - } + "$ref": "#/$defs/docs_config" }, "group": { "$ref": "#/$defs/group" @@ -490,12 +469,7 @@ "type": "string" }, "docs": { - "type": "object", - "properties": { - "show": { - "type": "boolean" - } - } + "$ref": "#/$defs/docs_config" }, "group": { "$ref": "#/$defs/group" @@ -814,6 +788,23 @@ }, "additionalProperties": false }, + "docs_config": { + "title": "Docs config", + "type": "object", + "description": "Configurations for the appearance of nodes in the dbt documentation.", + "properties": { + "node_color": { + "type": "string", + "description": "The color of the node on the DAG in the documentation. It must be an Hex code or a valid CSS color name.", + "pattern": "^(#[a-fA-F0-9]{3}|#[a-fA-F0-9]{6}|[^#][a-zA-Z]*)$" + }, + "show": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, "entity": { "required": ["name", "type"], "type": "object", diff --git a/schemas/dbt_yml_files.json b/schemas/dbt_yml_files.json index 34be77c..0dddc06 100644 --- a/schemas/dbt_yml_files.json +++ b/schemas/dbt_yml_files.json @@ -48,13 +48,7 @@ "type": "string" }, "docs": { - "type": "object", - "required": ["show"], - "properties": { - "show": { - "type": "boolean" - } - } + "$ref": "#/$defs/docs_config" } } } @@ -173,12 +167,7 @@ "type": "string" }, "docs": { - "type": "object", - "properties": { - "show": { - "type": "boolean" - } - } + "$ref": "#/$defs/docs_config" } }, "additionalProperties": false @@ -318,12 +307,7 @@ "type": "string" }, "docs": { - "type": "object", - "properties": { - "show": { - "type": "boolean" - } - } + "$ref": "#/$defs/docs_config" }, "group": { "type": "string" @@ -414,12 +398,7 @@ "type": "string" }, "docs": { - "type": "object", - "properties": { - "show": { - "type": "boolean" - } - } + "$ref": "#/$defs/docs_config" }, "tests": { "type": "array", @@ -497,12 +476,7 @@ "type": "string" }, "docs": { - "type": "object", - "properties": { - "show": { - "type": "boolean" - } - } + "$ref": "#/$defs/docs_config" }, "meta": { "type": "object" @@ -743,6 +717,23 @@ } } }, + "docs_config": { + "title": "Docs config", + "type": "object", + "description": "Configurations for the appearance of nodes in the dbt documentation.", + "properties": { + "node_color": { + "type": "string", + "description": "The color of the node on the DAG in the documentation. It must be an Hex code or a valid CSS color name.", + "pattern": "^(#[a-fA-F0-9]{3}|#[a-fA-F0-9]{6}|[^#][a-zA-Z]*)$" + }, + "show": { + "type": "boolean", + "default": true + } + }, + "additionalProperties": false + }, "freshness_definition": { "default": { "warn_after": { diff --git a/tests/1.5/valid/dbt_yml_files.yml b/tests/1.5/valid/dbt_yml_files.yml index 0731c87..bbca6d5 100644 --- a/tests/1.5/valid/dbt_yml_files.yml +++ b/tests/1.5/valid/dbt_yml_files.yml @@ -12,6 +12,9 @@ models: - name: my_second_dbt_model description: "A starter dbt model" + docs: + show: true + node_color: yellow columns: - name: id description: "The primary key for this table" diff --git a/tests/1.6/valid/dbt_yml_files.yml b/tests/1.6/valid/dbt_yml_files.yml index 504efd2..d3c7f0b 100644 --- a/tests/1.6/valid/dbt_yml_files.yml +++ b/tests/1.6/valid/dbt_yml_files.yml @@ -12,6 +12,9 @@ models: - name: my_second_dbt_model description: "A starter dbt model" + docs: + show: true + node_color: yellow columns: - name: id description: "The primary key for this table"