From 1ab6d12ab29e7af1e5191fb5f5cc57dabd868ba5 Mon Sep 17 00:00:00 2001 From: Dave Connors Date: Mon, 6 Mar 2023 09:43:27 -0600 Subject: [PATCH 01/13] initial config in yml entry --- schemas/dbt_yml_files.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/schemas/dbt_yml_files.json b/schemas/dbt_yml_files.json index 03e869a..e49e50e 100644 --- a/schemas/dbt_yml_files.json +++ b/schemas/dbt_yml_files.json @@ -302,6 +302,9 @@ } } }, + "contract": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, "description": { "type": "string" }, From f46347a9498f4367f7d8406176a1d4dc6363e52c Mon Sep 17 00:00:00 2001 From: Dave Connors Date: Mon, 6 Mar 2023 10:44:46 -0600 Subject: [PATCH 02/13] current model contract spec --- schemas/dbt_yml_files.json | 45 ++++++++++++++++++++++++++++++++++++++ tests/valid/schema.yml | 28 +++++++++++++++++++++++- 2 files changed, 72 insertions(+), 1 deletion(-) diff --git a/schemas/dbt_yml_files.json b/schemas/dbt_yml_files.json index e49e50e..cd8c286 100644 --- a/schemas/dbt_yml_files.json +++ b/schemas/dbt_yml_files.json @@ -118,6 +118,35 @@ } } }, + "groups": { + "type": "array", + "items": { + "type": "object", + "required": ["name", "owner"], + "properties": { + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "owner": { + "type": "object", + "minProperties": 1, + "properties": { + "name": { + "type": "string" + }, + "email": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + }, "macros": { "type": "array", "items": { @@ -246,6 +275,10 @@ "name": { "type": "string" }, + "access": { + "type": "string", + "enum": ["private", "protected", "public"] + }, "columns": { "type": "array", "items": { @@ -255,6 +288,9 @@ "config": { "type": "object", "properties": { + "contract": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, "grant_access_to": { "title": "Authorized views", "type": "array", @@ -316,6 +352,9 @@ } } }, + "group": { + "type": "string" + }, "meta": { "type": "object" }, @@ -637,6 +676,12 @@ "name": { "type": "string" }, + "constraints": { + "$ref": "#/$defs/array_of_strings" + }, + "constraints_check": { + "type": "string" + }, "data_type": { "type": "string" }, diff --git a/tests/valid/schema.yml b/tests/valid/schema.yml index c60a2e0..03f49aa 100644 --- a/tests/valid/schema.yml +++ b/tests/valid/schema.yml @@ -21,10 +21,36 @@ models: - unique - not_null + - name: my_contracted_dbt_model + description: "A dbt model with contracts" + access: public + group: analytics + config: + contract: true + columns: + - name: id + description: "The primary key for this table" + constraints: + - "not null" + - "unique" + constraints_check: (id > 0) + tests: + - unique + - not_null + snapshots: - name: snapshot_name description: slowly changing dimension columns: - name: id - description: cool column, eh? \ No newline at end of file + description: cool column, eh? + + +# model groups + +groups: + - name: analytics + owner: + name: dave + \ No newline at end of file From 0b90473e8f6b53eeb67e848a2fce23c70962be6f Mon Sep 17 00:00:00 2001 From: Dave Connors Date: Mon, 6 Mar 2023 10:45:21 -0600 Subject: [PATCH 03/13] remove description from groups for now --- schemas/dbt_yml_files.json | 3 --- 1 file changed, 3 deletions(-) diff --git a/schemas/dbt_yml_files.json b/schemas/dbt_yml_files.json index cd8c286..35ce5d2 100644 --- a/schemas/dbt_yml_files.json +++ b/schemas/dbt_yml_files.json @@ -127,9 +127,6 @@ "name": { "type": "string" }, - "description": { - "type": "string" - }, "owner": { "type": "object", "minProperties": 1, From 8793d92fb3e6efb152edda2a8d821a37bd9179dc Mon Sep 17 00:00:00 2001 From: Dave Connors Date: Mon, 6 Mar 2023 10:57:32 -0600 Subject: [PATCH 04/13] groups for metrics --- schemas/dbt_yml_files.json | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/schemas/dbt_yml_files.json b/schemas/dbt_yml_files.json index 35ce5d2..2e8bade 100644 --- a/schemas/dbt_yml_files.json +++ b/schemas/dbt_yml_files.json @@ -213,6 +213,20 @@ ] }, "properties": { + "config": { + "type": "object", + "properties": { + "enabled": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "treat_null_values_as_zero": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "group": { + "type": "string" + } + } + }, "name": { "type": "string" }, From 49a64d442709c52b8df22d1161558b8883633f3f Mon Sep 17 00:00:00 2001 From: Dave Connors Date: Tue, 7 Mar 2023 14:55:47 -0600 Subject: [PATCH 05/13] change everything to defs --- schemas/dbt_project.json | 451 ++++++++++++++++++++++++++++++--------- 1 file changed, 356 insertions(+), 95 deletions(-) diff --git a/schemas/dbt_project.json b/schemas/dbt_project.json index d6da5fb..a7d71db 100644 --- a/schemas/dbt_project.json +++ b/schemas/dbt_project.json @@ -163,7 +163,7 @@ } }, "empty_directory": { - "type": "null" + "type": "null" }, "boolean_or_jinja_string": { "oneOf": [ @@ -221,82 +221,110 @@ "description": "Configurations set in the dbt_project.yml file will apply to all models that don't have a more specific configuration set.", "properties": { "+bind": { - "$ref": "#/$defs/boolean_or_jinja_string", - "default": false + "$ref": "#/$defs/bind" }, "+database": { - "type": "string" + "$ref": "#/$defs/database" }, "+docs": { - "$ref": "#/$defs/docs_config" + "$ref": "#/$defs/docs" }, "+enabled": { - "$ref": "#/$defs/boolean_or_jinja_string" + "$ref": "#/$defs/enabled" }, "+grant_access_to": { - "title": "Authorized views", - "type": "array", - "description": "Configuration, specific to BigQuery adapter, used to setup authorized views.", - "items": { - "type": "object", - "properties": { - "database": { - "type": "string" - }, - "project": { - "type": "string" - } - }, - "additionalProperties": false - } + "$ref": "#/$defs/grant_access_to" }, "+hours_to_expiration": { - "type": "number", - "description": "Configuration specific to BigQuery adapter used to set an expiration delay (in hours) to a table." + "$ref": "#/$defs/hours_to_expiration" }, "+incremental_strategy": { - "type": "string" + "$ref": "#/$defs/incremental_strategy" }, "+kms_key_name": { - "type": "string", - "description": "Configuration, specific to BigQuery adapter, of the KMS key name used for data encryption." + "$ref": "#/$defs/kms_key_name" }, "+labels": { - "$ref": "#/$defs/label_configs" + "$ref": "#/$defs/labels" }, "+materialized": { - "type": "string" + "$ref": "#/$defs/materialized" }, "+on_schema_change": { - "type": "string", - "enum": [ - "append_new_columns", - "fail", - "ignore", - "sync_all_columns" - ] + "$ref": "#/$defs/on_schema_change" }, "+persist_docs": { - "$ref": "#/$defs/persist_docs_config" + "$ref": "#/$defs/persist_docs" }, "+post-hook": { - "$ref": "#/$defs/array_of_strings" + "$ref": "#/$defs/post-hook" }, "+pre-hook": { - "$ref": "#/$defs/array_of_strings" + "$ref": "#/$defs/pre-hook" }, "+schema": { - "type": "string" + "$ref": "#/$defs/schema" }, "+sql_header": { - "type": "string" + "$ref": "#/$defs/sql_header" }, "+tags": { - "$ref": "#/$defs/string_or_array_of_strings" + "$ref": "#/$defs/tags" + }, + "bind": { + "$ref": "#/$defs/bind" + }, + "database": { + "$ref": "#/$defs/database" + }, + "docs": { + "$ref": "#/$defs/docs" + }, + "enabled": { + "$ref": "#/$defs/enabled" + }, + "grant_access_to": { + "$ref": "#/$defs/grant_access_to" + }, + "hours_to_expiration": { + "$ref": "#/$defs/hours_to_expiration" + }, + "incremental_strategy": { + "$ref": "#/$defs/incremental_strategy" + }, + "kms_key_name": { + "$ref": "#/$defs/kms_key_name" + }, + "labels": { + "$ref": "#/$defs/labels" + }, + "materialized": { + "$ref": "#/$defs/materialized" + }, + "on_schema_change": { + "$ref": "#/$defs/on_schema_change" + }, + "persist_docs": { + "$ref": "#/$defs/persist_docs" + }, + "post-hook": { + "$ref": "#/$defs/post-hook" + }, + "pre-hook": { + "$ref": "#/$defs/pre-hook" + }, + "schema": { + "$ref": "#/$defs/schema" + }, + "sql_header": { + "$ref": "#/$defs/sql_header" + }, + "tags": { + "$ref": "#/$defs/tags" } }, "additionalProperties": { - "oneOf" : [ + "oneOf": [ { "$ref": "#/$defs/model_configs" }, @@ -327,40 +355,62 @@ "type": "object", "properties": { "+copy_grants": { - "$ref": "#/$defs/boolean_or_jinja_string" + "$ref": "#/$defs/copy_grants" }, "+database": { - "type": "string" + "$ref": "#/$defs/database" }, "+enabled": { - "$ref": "#/$defs/boolean_or_jinja_string" + "$ref": "#/$defs/enabled" }, "+persist_docs": { - "$ref": "#/$defs/persist_docs_config" + "$ref": "#/$defs/persist_docs" }, "+quote_columns": { - "$ref": "#/$defs/boolean_or_jinja_string" + "$ref": "#/$defs/quote_columns" }, "+schema": { - "type": "string" + "$ref": "#/$defs/schema" }, "+tags": { - "$ref": "#/$defs/string_or_array_of_strings" + "$ref": "#/$defs/tags" }, "+column_types": { - "type": "object", - "patternProperties": { - "": { - "type": "string" - } - } + "$ref": "#/$defs/column_types" }, "+full_refresh": { - "$ref": "#/$defs/boolean_or_jinja_string" + "$ref": "#/$defs/full_refresh" + }, + "copy_grants": { + "$ref": "#/$defs/copy_grants" + }, + "database": { + "$ref": "#/$defs/database" + }, + "enabled": { + "$ref": "#/$defs/enabled" + }, + "persist_docs": { + "$ref": "#/$defs/persist_docs" + }, + "quote_columns": { + "$ref": "#/$defs/quote_columns" + }, + "schema": { + "$ref": "#/$defs/schema" + }, + "tags": { + "$ref": "#/$defs/tags" + }, + "column_types": { + "$ref": "#/$defs/column_types" + }, + "full_refresh": { + "$ref": "#/$defs/full_refresh" } }, "additionalProperties": { - "oneOf" : [ + "oneOf": [ { "$ref": "#/$defs/seed_configs" }, @@ -375,50 +425,92 @@ "type": "object", "properties": { "+alias": { - "type": "string" + "$ref": "#/$defs/alias" }, "+check_cols": { - "$ref": "#/$defs/string_or_array_of_strings" + "$ref": "#/$defs/check_cols" }, "+enabled": { - "$ref": "#/$defs/boolean_or_jinja_string" + "$ref": "#/$defs/enabled" }, "+grants": { - "type": "object" + "$ref": "#/$defs/grants" }, "+persist_docs": { - "$ref": "#/$defs/persist_docs_config" + "$ref": "#/$defs/persist_docs" }, "+post-hook": { - "$ref": "#/$defs/array_of_strings" + "$ref": "#/$defs/post-hook" }, "+pre-hook": { - "$ref": "#/$defs/array_of_strings" + "$ref": "#/$defs/pre-hook" }, "+quote_columns": { - "$ref": "#/$defs/boolean_or_jinja_string" + "$ref": "#/$defs/quote_columns" }, "+strategy": { - "type": "string" + "$ref": "#/$defs/strategy" }, "+tags": { - "$ref": "#/$defs/string_or_array_of_strings" + "$ref": "#/$defs/tags" }, "+target_database": { - "type": "string" + "$ref": "#/$defs/target_database" }, "+target_schema": { - "type": "string" + "$ref": "#/$defs/target_schema" }, "+unique_key": { - "$ref": "#/$defs/string_or_array_of_strings" + "$ref": "#/$defs/unique_key" }, "+updated_at": { - "type": "string" + "$ref": "#/$defs/updated_at" + }, + "alias": { + "$ref": "#/$defs/alias" + }, + "check_cols": { + "$ref": "#/$defs/check_cols" + }, + "enabled": { + "$ref": "#/$defs/enabled" + }, + "grants": { + "$ref": "#/$defs/grants" + }, + "persist_docs": { + "$ref": "#/$defs/persist_docs" + }, + "post-hook": { + "$ref": "#/$defs/post-hook" + }, + "pre-hook": { + "$ref": "#/$defs/pre-hook" + }, + "quote_columns": { + "$ref": "#/$defs/quote_columns" + }, + "strategy": { + "$ref": "#/$defs/strategy" + }, + "tags": { + "$ref": "#/$defs/tags" + }, + "target_database": { + "$ref": "#/$defs/target_database" + }, + "target_schema": { + "$ref": "#/$defs/target_schema" + }, + "unique_key": { + "$ref": "#/$defs/unique_key" + }, + "updated_at": { + "$ref": "#/$defs/updated_at" } }, "additionalProperties": { - "oneOf" : [ + "oneOf": [ { "$ref": "#/$defs/snapshot_configs" }, @@ -433,14 +525,20 @@ "type": "object", "properties": { "+enabled": { - "$ref": "#/$defs/boolean_or_jinja_string" + "$ref": "#/$defs/enabled" }, "+tags": { - "$ref": "#/$defs/string_or_array_of_strings" + "$ref": "#/$defs/tags" + }, + "enabled": { + "$ref": "#/$defs/enabled" + }, + "tags": { + "$ref": "#/$defs/tags" } }, "additionalProperties": { - "oneOf" : [ + "oneOf": [ { "$ref": "#/$defs/source_configs" }, @@ -466,48 +564,74 @@ "description": "Configurations set in the dbt_project.yml file will apply to all tests that don't have a more specific configuration set.", "properties": { "+alias": { - "type": "string", - "description": "Only relevant when `store_failures` is true" + "$ref": "#/$defs/alias" }, "+database": { - "type": "string", - "description": "Only relevant when `store_failures` is true" + "$ref": "#/$defs/database" }, "+enabled": { - "$ref": "#/$defs/boolean_or_jinja_string" + "$ref": "#/$defs/enabled" }, "+error_if": { - "type": "string" + "$ref": "#/$defs/error_if" }, "+fail_calc": { - "type": "string" + "$ref": "#/$defs/fail_calc" }, "+limit": { - "type": "number" + "$ref": "#/$defs/limit" }, "+schema": { - "type": "string", - "description": "Only relevant when `store_failures` is true" + "$ref": "#/$defs/schema" }, "+severity": { - "type": "string", - "enum": [ - "warn", - "error" - ] + "$ref": "#/$defs/severity" }, "+store_failures": { - "$ref": "#/$defs/boolean_or_jinja_string" + "$ref": "#/$defs/store_failures" }, "+tags": { - "$ref": "#/$defs/string_or_array_of_strings" + "$ref": "#/$defs/tags" }, "+warn_if": { - "type": "string" + "$ref": "#/$defs/warn_if" + }, + "alias": { + "$ref": "#/$defs/alias" + }, + "database": { + "$ref": "#/$defs/database" + }, + "enabled": { + "$ref": "#/$defs/enabled" + }, + "error_if": { + "$ref": "#/$defs/error_if" + }, + "fail_calc": { + "$ref": "#/$defs/fail_calc" + }, + "limit": { + "$ref": "#/$defs/limit" + }, + "schema": { + "$ref": "#/$defs/schema" + }, + "severity": { + "$ref": "#/$defs/severity" + }, + "store_failures": { + "$ref": "#/$defs/store_failures" + }, + "tags": { + "$ref": "#/$defs/tags" + }, + "warn_if": { + "$ref": "#/$defs/warn_if" } }, "additionalProperties": { - "oneOf" : [ + "oneOf": [ { "$ref": "#/$defs/test_configs" }, @@ -516,6 +640,143 @@ } ] } + }, + "bind": { + "$ref": "#/$defs/boolean_or_jinja_string", + "default": false + }, + "database": { + "type": "string" + }, + "docs": { + "$ref": "#/$defs/docs_config" + }, + "enabled": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "grant_access_to": { + "title": "Authorized views", + "type": "array", + "description": "Configuration, specific to BigQuery adapter, used to setup authorized views.", + "items": { + "type": "object", + "properties": { + "database": { + "type": "string" + }, + "project": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "hours_to_expiration": { + "type": "number", + "description": "Configuration specific to BigQuery adapter used to set an expiration delay (in hours) to a table." + }, + "incremental_strategy": { + "type": "string" + }, + "kms_key_name": { + "type": "string", + "description": "Configuration, specific to BigQuery adapter, of the KMS key name used for data encryption." + }, + "labels": { + "$ref": "#/$defs/label_configs" + }, + "materialized": { + "type": "string" + }, + "on_schema_change": { + "type": "string", + "enum": [ + "append_new_columns", + "fail", + "ignore", + "sync_all_columns" + ] + }, + "persist_docs": { + "$ref": "#/$defs/persist_docs_config" + }, + "post-hook": { + "$ref": "#/$defs/array_of_strings" + }, + "pre-hook": { + "$ref": "#/$defs/array_of_strings" + }, + "schema": { + "type": "string" + }, + "sql_header": { + "type": "string" + }, + "tags": { + "$ref": "#/$defs/string_or_array_of_strings" + }, + "copy_grants": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "quote_columns": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "column_types": { + "type": "object", + "patternProperties": { + "": { + "type": "string" + } + } + }, + "full_refresh": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "alias": { + "type": "string" + }, + "check_cols": { + "$ref": "#/$defs/string_or_array_of_strings" + }, + "grants": { + "type": "object" + }, + "strategy": { + "type": "string" + }, + "target_database": { + "type": "string" + }, + "target_schema": { + "type": "string" + }, + "unique_key": { + "$ref": "#/$defs/string_or_array_of_strings" + }, + "updated_at": { + "type": "string" + }, + "error_if": { + "type": "string" + }, + "fail_calc": { + "type": "string" + }, + "limit": { + "type": "number" + }, + "severity": { + "type": "string", + "enum": [ + "warn", + "error" + ] + }, + "store_failures": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "warn_if": { + "type": "string" } } -} +} \ No newline at end of file From f6affa21acffd4ad411e802c3cf40b90b664470c Mon Sep 17 00:00:00 2001 From: Dave Connors Date: Tue, 7 Mar 2023 14:58:59 -0600 Subject: [PATCH 06/13] Revert "change everything to defs" This reverts commit 49a64d442709c52b8df22d1161558b8883633f3f. --- schemas/dbt_project.json | 451 +++++++++------------------------------ 1 file changed, 95 insertions(+), 356 deletions(-) diff --git a/schemas/dbt_project.json b/schemas/dbt_project.json index a7d71db..d6da5fb 100644 --- a/schemas/dbt_project.json +++ b/schemas/dbt_project.json @@ -163,7 +163,7 @@ } }, "empty_directory": { - "type": "null" + "type": "null" }, "boolean_or_jinja_string": { "oneOf": [ @@ -221,110 +221,82 @@ "description": "Configurations set in the dbt_project.yml file will apply to all models that don't have a more specific configuration set.", "properties": { "+bind": { - "$ref": "#/$defs/bind" + "$ref": "#/$defs/boolean_or_jinja_string", + "default": false }, "+database": { - "$ref": "#/$defs/database" + "type": "string" }, "+docs": { - "$ref": "#/$defs/docs" + "$ref": "#/$defs/docs_config" }, "+enabled": { - "$ref": "#/$defs/enabled" + "$ref": "#/$defs/boolean_or_jinja_string" }, "+grant_access_to": { - "$ref": "#/$defs/grant_access_to" + "title": "Authorized views", + "type": "array", + "description": "Configuration, specific to BigQuery adapter, used to setup authorized views.", + "items": { + "type": "object", + "properties": { + "database": { + "type": "string" + }, + "project": { + "type": "string" + } + }, + "additionalProperties": false + } }, "+hours_to_expiration": { - "$ref": "#/$defs/hours_to_expiration" + "type": "number", + "description": "Configuration specific to BigQuery adapter used to set an expiration delay (in hours) to a table." }, "+incremental_strategy": { - "$ref": "#/$defs/incremental_strategy" + "type": "string" }, "+kms_key_name": { - "$ref": "#/$defs/kms_key_name" + "type": "string", + "description": "Configuration, specific to BigQuery adapter, of the KMS key name used for data encryption." }, "+labels": { - "$ref": "#/$defs/labels" + "$ref": "#/$defs/label_configs" }, "+materialized": { - "$ref": "#/$defs/materialized" + "type": "string" }, "+on_schema_change": { - "$ref": "#/$defs/on_schema_change" + "type": "string", + "enum": [ + "append_new_columns", + "fail", + "ignore", + "sync_all_columns" + ] }, "+persist_docs": { - "$ref": "#/$defs/persist_docs" + "$ref": "#/$defs/persist_docs_config" }, "+post-hook": { - "$ref": "#/$defs/post-hook" + "$ref": "#/$defs/array_of_strings" }, "+pre-hook": { - "$ref": "#/$defs/pre-hook" + "$ref": "#/$defs/array_of_strings" }, "+schema": { - "$ref": "#/$defs/schema" + "type": "string" }, "+sql_header": { - "$ref": "#/$defs/sql_header" + "type": "string" }, "+tags": { - "$ref": "#/$defs/tags" - }, - "bind": { - "$ref": "#/$defs/bind" - }, - "database": { - "$ref": "#/$defs/database" - }, - "docs": { - "$ref": "#/$defs/docs" - }, - "enabled": { - "$ref": "#/$defs/enabled" - }, - "grant_access_to": { - "$ref": "#/$defs/grant_access_to" - }, - "hours_to_expiration": { - "$ref": "#/$defs/hours_to_expiration" - }, - "incremental_strategy": { - "$ref": "#/$defs/incremental_strategy" - }, - "kms_key_name": { - "$ref": "#/$defs/kms_key_name" - }, - "labels": { - "$ref": "#/$defs/labels" - }, - "materialized": { - "$ref": "#/$defs/materialized" - }, - "on_schema_change": { - "$ref": "#/$defs/on_schema_change" - }, - "persist_docs": { - "$ref": "#/$defs/persist_docs" - }, - "post-hook": { - "$ref": "#/$defs/post-hook" - }, - "pre-hook": { - "$ref": "#/$defs/pre-hook" - }, - "schema": { - "$ref": "#/$defs/schema" - }, - "sql_header": { - "$ref": "#/$defs/sql_header" - }, - "tags": { - "$ref": "#/$defs/tags" + "$ref": "#/$defs/string_or_array_of_strings" } }, "additionalProperties": { - "oneOf": [ + "oneOf" : [ { "$ref": "#/$defs/model_configs" }, @@ -355,62 +327,40 @@ "type": "object", "properties": { "+copy_grants": { - "$ref": "#/$defs/copy_grants" + "$ref": "#/$defs/boolean_or_jinja_string" }, "+database": { - "$ref": "#/$defs/database" + "type": "string" }, "+enabled": { - "$ref": "#/$defs/enabled" + "$ref": "#/$defs/boolean_or_jinja_string" }, "+persist_docs": { - "$ref": "#/$defs/persist_docs" + "$ref": "#/$defs/persist_docs_config" }, "+quote_columns": { - "$ref": "#/$defs/quote_columns" + "$ref": "#/$defs/boolean_or_jinja_string" }, "+schema": { - "$ref": "#/$defs/schema" + "type": "string" }, "+tags": { - "$ref": "#/$defs/tags" + "$ref": "#/$defs/string_or_array_of_strings" }, "+column_types": { - "$ref": "#/$defs/column_types" + "type": "object", + "patternProperties": { + "": { + "type": "string" + } + } }, "+full_refresh": { - "$ref": "#/$defs/full_refresh" - }, - "copy_grants": { - "$ref": "#/$defs/copy_grants" - }, - "database": { - "$ref": "#/$defs/database" - }, - "enabled": { - "$ref": "#/$defs/enabled" - }, - "persist_docs": { - "$ref": "#/$defs/persist_docs" - }, - "quote_columns": { - "$ref": "#/$defs/quote_columns" - }, - "schema": { - "$ref": "#/$defs/schema" - }, - "tags": { - "$ref": "#/$defs/tags" - }, - "column_types": { - "$ref": "#/$defs/column_types" - }, - "full_refresh": { - "$ref": "#/$defs/full_refresh" + "$ref": "#/$defs/boolean_or_jinja_string" } }, "additionalProperties": { - "oneOf": [ + "oneOf" : [ { "$ref": "#/$defs/seed_configs" }, @@ -425,92 +375,50 @@ "type": "object", "properties": { "+alias": { - "$ref": "#/$defs/alias" + "type": "string" }, "+check_cols": { - "$ref": "#/$defs/check_cols" + "$ref": "#/$defs/string_or_array_of_strings" }, "+enabled": { - "$ref": "#/$defs/enabled" + "$ref": "#/$defs/boolean_or_jinja_string" }, "+grants": { - "$ref": "#/$defs/grants" + "type": "object" }, "+persist_docs": { - "$ref": "#/$defs/persist_docs" + "$ref": "#/$defs/persist_docs_config" }, "+post-hook": { - "$ref": "#/$defs/post-hook" + "$ref": "#/$defs/array_of_strings" }, "+pre-hook": { - "$ref": "#/$defs/pre-hook" + "$ref": "#/$defs/array_of_strings" }, "+quote_columns": { - "$ref": "#/$defs/quote_columns" + "$ref": "#/$defs/boolean_or_jinja_string" }, "+strategy": { - "$ref": "#/$defs/strategy" + "type": "string" }, "+tags": { - "$ref": "#/$defs/tags" + "$ref": "#/$defs/string_or_array_of_strings" }, "+target_database": { - "$ref": "#/$defs/target_database" + "type": "string" }, "+target_schema": { - "$ref": "#/$defs/target_schema" + "type": "string" }, "+unique_key": { - "$ref": "#/$defs/unique_key" + "$ref": "#/$defs/string_or_array_of_strings" }, "+updated_at": { - "$ref": "#/$defs/updated_at" - }, - "alias": { - "$ref": "#/$defs/alias" - }, - "check_cols": { - "$ref": "#/$defs/check_cols" - }, - "enabled": { - "$ref": "#/$defs/enabled" - }, - "grants": { - "$ref": "#/$defs/grants" - }, - "persist_docs": { - "$ref": "#/$defs/persist_docs" - }, - "post-hook": { - "$ref": "#/$defs/post-hook" - }, - "pre-hook": { - "$ref": "#/$defs/pre-hook" - }, - "quote_columns": { - "$ref": "#/$defs/quote_columns" - }, - "strategy": { - "$ref": "#/$defs/strategy" - }, - "tags": { - "$ref": "#/$defs/tags" - }, - "target_database": { - "$ref": "#/$defs/target_database" - }, - "target_schema": { - "$ref": "#/$defs/target_schema" - }, - "unique_key": { - "$ref": "#/$defs/unique_key" - }, - "updated_at": { - "$ref": "#/$defs/updated_at" + "type": "string" } }, "additionalProperties": { - "oneOf": [ + "oneOf" : [ { "$ref": "#/$defs/snapshot_configs" }, @@ -525,20 +433,14 @@ "type": "object", "properties": { "+enabled": { - "$ref": "#/$defs/enabled" + "$ref": "#/$defs/boolean_or_jinja_string" }, "+tags": { - "$ref": "#/$defs/tags" - }, - "enabled": { - "$ref": "#/$defs/enabled" - }, - "tags": { - "$ref": "#/$defs/tags" + "$ref": "#/$defs/string_or_array_of_strings" } }, "additionalProperties": { - "oneOf": [ + "oneOf" : [ { "$ref": "#/$defs/source_configs" }, @@ -564,74 +466,48 @@ "description": "Configurations set in the dbt_project.yml file will apply to all tests that don't have a more specific configuration set.", "properties": { "+alias": { - "$ref": "#/$defs/alias" + "type": "string", + "description": "Only relevant when `store_failures` is true" }, "+database": { - "$ref": "#/$defs/database" + "type": "string", + "description": "Only relevant when `store_failures` is true" }, "+enabled": { - "$ref": "#/$defs/enabled" + "$ref": "#/$defs/boolean_or_jinja_string" }, "+error_if": { - "$ref": "#/$defs/error_if" + "type": "string" }, "+fail_calc": { - "$ref": "#/$defs/fail_calc" + "type": "string" }, "+limit": { - "$ref": "#/$defs/limit" + "type": "number" }, "+schema": { - "$ref": "#/$defs/schema" + "type": "string", + "description": "Only relevant when `store_failures` is true" }, "+severity": { - "$ref": "#/$defs/severity" + "type": "string", + "enum": [ + "warn", + "error" + ] }, "+store_failures": { - "$ref": "#/$defs/store_failures" + "$ref": "#/$defs/boolean_or_jinja_string" }, "+tags": { - "$ref": "#/$defs/tags" + "$ref": "#/$defs/string_or_array_of_strings" }, "+warn_if": { - "$ref": "#/$defs/warn_if" - }, - "alias": { - "$ref": "#/$defs/alias" - }, - "database": { - "$ref": "#/$defs/database" - }, - "enabled": { - "$ref": "#/$defs/enabled" - }, - "error_if": { - "$ref": "#/$defs/error_if" - }, - "fail_calc": { - "$ref": "#/$defs/fail_calc" - }, - "limit": { - "$ref": "#/$defs/limit" - }, - "schema": { - "$ref": "#/$defs/schema" - }, - "severity": { - "$ref": "#/$defs/severity" - }, - "store_failures": { - "$ref": "#/$defs/store_failures" - }, - "tags": { - "$ref": "#/$defs/tags" - }, - "warn_if": { - "$ref": "#/$defs/warn_if" + "type": "string" } }, "additionalProperties": { - "oneOf": [ + "oneOf" : [ { "$ref": "#/$defs/test_configs" }, @@ -640,143 +516,6 @@ } ] } - }, - "bind": { - "$ref": "#/$defs/boolean_or_jinja_string", - "default": false - }, - "database": { - "type": "string" - }, - "docs": { - "$ref": "#/$defs/docs_config" - }, - "enabled": { - "$ref": "#/$defs/boolean_or_jinja_string" - }, - "grant_access_to": { - "title": "Authorized views", - "type": "array", - "description": "Configuration, specific to BigQuery adapter, used to setup authorized views.", - "items": { - "type": "object", - "properties": { - "database": { - "type": "string" - }, - "project": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "hours_to_expiration": { - "type": "number", - "description": "Configuration specific to BigQuery adapter used to set an expiration delay (in hours) to a table." - }, - "incremental_strategy": { - "type": "string" - }, - "kms_key_name": { - "type": "string", - "description": "Configuration, specific to BigQuery adapter, of the KMS key name used for data encryption." - }, - "labels": { - "$ref": "#/$defs/label_configs" - }, - "materialized": { - "type": "string" - }, - "on_schema_change": { - "type": "string", - "enum": [ - "append_new_columns", - "fail", - "ignore", - "sync_all_columns" - ] - }, - "persist_docs": { - "$ref": "#/$defs/persist_docs_config" - }, - "post-hook": { - "$ref": "#/$defs/array_of_strings" - }, - "pre-hook": { - "$ref": "#/$defs/array_of_strings" - }, - "schema": { - "type": "string" - }, - "sql_header": { - "type": "string" - }, - "tags": { - "$ref": "#/$defs/string_or_array_of_strings" - }, - "copy_grants": { - "$ref": "#/$defs/boolean_or_jinja_string" - }, - "quote_columns": { - "$ref": "#/$defs/boolean_or_jinja_string" - }, - "column_types": { - "type": "object", - "patternProperties": { - "": { - "type": "string" - } - } - }, - "full_refresh": { - "$ref": "#/$defs/boolean_or_jinja_string" - }, - "alias": { - "type": "string" - }, - "check_cols": { - "$ref": "#/$defs/string_or_array_of_strings" - }, - "grants": { - "type": "object" - }, - "strategy": { - "type": "string" - }, - "target_database": { - "type": "string" - }, - "target_schema": { - "type": "string" - }, - "unique_key": { - "$ref": "#/$defs/string_or_array_of_strings" - }, - "updated_at": { - "type": "string" - }, - "error_if": { - "type": "string" - }, - "fail_calc": { - "type": "string" - }, - "limit": { - "type": "number" - }, - "severity": { - "type": "string", - "enum": [ - "warn", - "error" - ] - }, - "store_failures": { - "$ref": "#/$defs/boolean_or_jinja_string" - }, - "warn_if": { - "type": "string" } } -} \ No newline at end of file +} From 3ac65455f9966d89fffa484814b0b9cf6bbb2939 Mon Sep 17 00:00:00 2001 From: Dave Connors Date: Tue, 14 Mar 2023 09:33:49 -0500 Subject: [PATCH 07/13] allow contract config in project yml --- schemas/dbt_project.json | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/schemas/dbt_project.json b/schemas/dbt_project.json index 4962d0a..75e5bb6 100644 --- a/schemas/dbt_project.json +++ b/schemas/dbt_project.json @@ -224,6 +224,9 @@ "$ref": "#/$defs/boolean_or_jinja_string", "default": false }, + "+contract": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, "+database": { "$ref": "#/$defs/database" }, @@ -276,6 +279,9 @@ "$ref": "#/$defs/boolean_or_jinja_string", "default": false }, + "contract": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, "database": { "$ref": "#/$defs/database" }, From 830c7ae92eff77f8e5409af13b44a0e9d843a062 Mon Sep 17 00:00:00 2001 From: Dave Connors Date: Thu, 30 Mar 2023 15:34:12 -0500 Subject: [PATCH 08/13] committing to view diff --- schemas/dbt_yml_files.json | 133 +++++++++++++++++++++++-------------- tests/valid/schema.yml | 8 ++- 2 files changed, 89 insertions(+), 52 deletions(-) diff --git a/schemas/dbt_yml_files.json b/schemas/dbt_yml_files.json index 1645a23..825804b 100644 --- a/schemas/dbt_yml_files.json +++ b/schemas/dbt_yml_files.json @@ -297,57 +297,7 @@ } }, "config": { - "type": "object", - "properties": { - "contract": { - "$ref": "#/$defs/boolean_or_jinja_string" - }, - "grant_access_to": { - "title": "Authorized views", - "type": "array", - "description": "Configuration, specific to BigQuery adapter, used to setup authorized views.", - "items": { - "type": "object", - "required": ["database", "project"], - "properties": { - "database": { - "type": "string" - }, - "project": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "hours_to_expiration": { - "type": "number", - "description": "Configuration specific to BigQuery adapter used to set an expiration delay (in hours) to a table." - }, - "kms_key_name": { - "type": "string", - "description": "Configuration of the KMS key name, specific to BigQuery adapter.", - "pattern": "projects/[a-zA-Z0-9_-]*/locations/[a-zA-Z0-9_-]*/keyRings/.*/cryptoKeys/.*" - }, - "labels": { - "title": "Label configs", - "type": "object", - "description": "Configuration specific to BigQuery adapter used to add labels and tags to tables/views created by dbt.", - "patternProperties": { - "^[a-z][a-z0-9_-]{0,62}$": { - "type": "string", - "pattern": "^[a-z0-9_-]{0,63}$" - } - }, - "additionalProperties": false - }, - "materialized": { - "type": "string" - }, - "sql_header": { - "type": "string" - } - } + "$refs": "#/$defs/model_configs" }, "contract": { "$ref": "#/$defs/boolean_or_jinja_string" @@ -373,6 +323,29 @@ "type": "array", "items": { "$ref": "#/$defs/tests" + }, + "versions": { + "type": "array", + "items": { + "type": "object", + "required": [ + "v" + ], + "properties": { + "v" : {"type": "number"}, + "config" : {"$ref": "#/$defs/model_configs"}, + "columns" : { + "type": "object", + "properties": { + "include": { + "$ref": "#/$defs/string_or_array_of_strings" + }, + "exclude": { + "$ref": "#/$defs/string_or_array_of_strings" + } + } + } + } } } }, @@ -775,6 +748,64 @@ "type": "string", "pattern": "\\{\\{.*\\}\\}" }, + "model_configs": { + "type": "object", + "properties": { + "contract": { + "type" : "object", + "properties": { + "enforced" : { + "$ref": "#/$defs/boolean_or_jinja_string" + } + } + }, + "grant_access_to": { + "title": "Authorized views", + "type": "array", + "description": "Configuration, specific to BigQuery adapter, used to setup authorized views.", + "items": { + "type": "object", + "required": ["database", "project"], + "properties": { + "database": { + "type": "string" + }, + "project": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "hours_to_expiration": { + "type": "number", + "description": "Configuration specific to BigQuery adapter used to set an expiration delay (in hours) to a table." + }, + "kms_key_name": { + "type": "string", + "description": "Configuration of the KMS key name, specific to BigQuery adapter.", + "pattern": "projects/[a-zA-Z0-9_-]*/locations/[a-zA-Z0-9_-]*/keyRings/.*/cryptoKeys/.*" + }, + "labels": { + "title": "Label configs", + "type": "object", + "description": "Configuration specific to BigQuery adapter used to add labels and tags to tables/views created by dbt.", + "patternProperties": { + "^[a-z][a-z0-9_-]{0,62}$": { + "type": "string", + "pattern": "^[a-z0-9_-]{0,63}$" + } + }, + "additionalProperties": false + }, + "materialized": { + "type": "string" + }, + "sql_header": { + "type": "string" + } + } + }, "number_or_jinja_string": { "oneOf": [ { diff --git a/tests/valid/schema.yml b/tests/valid/schema.yml index 56d9651..50bd8ce 100644 --- a/tests/valid/schema.yml +++ b/tests/valid/schema.yml @@ -24,7 +24,8 @@ models: access: public group: analytics config: - contract: true + contract: + enforced: true columns: - name: id description: "The primary key for this table" @@ -35,6 +36,11 @@ models: tests: - unique - not_null + versions: + - v: 2 + columns: + - include: '*' + exclude: country_name # this is the breaking snapshots: From f87468df7ee03344f3e4233a7672acf6dc2a2157 Mon Sep 17 00:00:00 2001 From: Dave Connors Date: Thu, 30 Mar 2023 16:47:10 -0500 Subject: [PATCH 09/13] model version, model level contracts --- schemas/dbt_yml_files.json | 67 ++++++++++++++++++++++++++++---------- tests/valid/schema.yml | 23 ++++++++++++- 2 files changed, 71 insertions(+), 19 deletions(-) diff --git a/schemas/dbt_yml_files.json b/schemas/dbt_yml_files.json index 825804b..9466f76 100644 --- a/schemas/dbt_yml_files.json +++ b/schemas/dbt_yml_files.json @@ -299,6 +299,26 @@ "config": { "$refs": "#/$defs/model_configs" }, + "constraints": { + "type": "array", + "items": { + "type": "object", + "properties": { + "columns": { + "$ref": "#/$defs/string_or_array_of_strings" + }, + "expression": { "type": "string" }, + "type": { "type": "string" }, + "name": { "type": "string" }, + "warn_unenforced": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "warn_unsupported": { + "$ref": "#/$defs/boolean_or_jinja_string" + } + } + } + }, "contract": { "$ref": "#/$defs/boolean_or_jinja_string" }, @@ -316,6 +336,9 @@ "group": { "type": "string" }, + "latest_version": { + "type": "number" + }, "meta": { "type": "object" }, @@ -323,27 +346,24 @@ "type": "array", "items": { "$ref": "#/$defs/tests" - }, + } + }, "versions": { "type": "array", "items": { "type": "object", - "required": [ - "v" - ], + "required": ["v"], "properties": { - "v" : {"type": "number"}, - "config" : {"$ref": "#/$defs/model_configs"}, - "columns" : { - "type": "object", - "properties": { - "include": { - "$ref": "#/$defs/string_or_array_of_strings" - }, - "exclude": { - "$ref": "#/$defs/string_or_array_of_strings" - } - } + "v": { "type": "number" }, + "config": { "$ref": "#/$defs/model_configs" }, + "columns": { + "type": "array", + "items": { + "anyOf": [ + { "$ref": "#/$defs/include_exclude" }, + { "$ref": "#/$defs/column_properties" } + ] + } } } } @@ -744,6 +764,17 @@ }, "additionalProperties": false }, + "include_exclude": { + "type": "object", + "properties": { + "include": { + "$ref": "#/$defs/string_or_array_of_strings" + }, + "exclude": { + "$ref": "#/$defs/string_or_array_of_strings" + } + } + }, "jinja_string": { "type": "string", "pattern": "\\{\\{.*\\}\\}" @@ -752,9 +783,9 @@ "type": "object", "properties": { "contract": { - "type" : "object", + "type": "object", "properties": { - "enforced" : { + "enforced": { "$ref": "#/$defs/boolean_or_jinja_string" } } diff --git a/tests/valid/schema.yml b/tests/valid/schema.yml index 50bd8ce..c854455 100644 --- a/tests/valid/schema.yml +++ b/tests/valid/schema.yml @@ -23,12 +23,14 @@ models: description: "A dbt model with contracts" access: public group: analytics + latest_version: 2 config: contract: enforced: true columns: - name: id description: "The primary key for this table" + data_type: int constraints: - "not null" - "unique" @@ -40,7 +42,26 @@ models: - v: 2 columns: - include: '*' - exclude: country_name # this is the breaking + exclude: country_name + - name: id # included in addition the '*' set. if customer_id were in the '*' set -> override it + description: This is the primary key + data_type: float + - v: 1 + config: + alias: dim_customers + + - name: my_model_level_contract_model + config: + contract: + enforced: true + constraints: + - type: check + expression: (id > 0) + - type: primary_key + columns: [ id ] + - type: unique + columns: [ color, date_day ] + name: strange_uniqueness_requirement snapshots: From 4204ed4a0603207e37d39feb48c0b821e6f76d9c Mon Sep 17 00:00:00 2001 From: Dave Connors Date: Thu, 30 Mar 2023 16:50:16 -0500 Subject: [PATCH 10/13] add require type --- schemas/dbt_yml_files.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/schemas/dbt_yml_files.json b/schemas/dbt_yml_files.json index 9466f76..c055101 100644 --- a/schemas/dbt_yml_files.json +++ b/schemas/dbt_yml_files.json @@ -303,6 +303,9 @@ "type": "array", "items": { "type": "object", + "required": [ + "type" + ], "properties": { "columns": { "$ref": "#/$defs/string_or_array_of_strings" From a350bde4b69005fab604c2f31928e8d69332dcde Mon Sep 17 00:00:00 2001 From: Dave Connors Date: Thu, 30 Mar 2023 16:59:25 -0500 Subject: [PATCH 11/13] refs to ref --- schemas/dbt_yml_files.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schemas/dbt_yml_files.json b/schemas/dbt_yml_files.json index c055101..3efc86f 100644 --- a/schemas/dbt_yml_files.json +++ b/schemas/dbt_yml_files.json @@ -297,7 +297,7 @@ } }, "config": { - "$refs": "#/$defs/model_configs" + "$ref": "#/$defs/model_configs" }, "constraints": { "type": "array", From a6538dbbf8b0755bef63587492e0a5a8934da7a4 Mon Sep 17 00:00:00 2001 From: Dave Connors Date: Fri, 31 Mar 2023 08:36:39 -0500 Subject: [PATCH 12/13] multi-line, unify constraints dict, remove constraints_check --- schemas/dbt_yml_files.json | 73 +++++++++++++++++++++----------------- tests/valid/schema.yml | 9 ++--- 2 files changed, 46 insertions(+), 36 deletions(-) diff --git a/schemas/dbt_yml_files.json b/schemas/dbt_yml_files.json index 3efc86f..01e2739 100644 --- a/schemas/dbt_yml_files.json +++ b/schemas/dbt_yml_files.json @@ -300,30 +300,7 @@ "$ref": "#/$defs/model_configs" }, "constraints": { - "type": "array", - "items": { - "type": "object", - "required": [ - "type" - ], - "properties": { - "columns": { - "$ref": "#/$defs/string_or_array_of_strings" - }, - "expression": { "type": "string" }, - "type": { "type": "string" }, - "name": { "type": "string" }, - "warn_unenforced": { - "$ref": "#/$defs/boolean_or_jinja_string" - }, - "warn_unsupported": { - "$ref": "#/$defs/boolean_or_jinja_string" - } - } - } - }, - "contract": { - "$ref": "#/$defs/boolean_or_jinja_string" + "$ref": "#/$defs/constraints" }, "description": { "type": "string" @@ -357,14 +334,22 @@ "type": "object", "required": ["v"], "properties": { - "v": { "type": "number" }, - "config": { "$ref": "#/$defs/model_configs" }, + "v": { + "type": "number" + }, + "config": { + "$ref": "#/$defs/model_configs" + }, "columns": { "type": "array", "items": { "anyOf": [ - { "$ref": "#/$defs/include_exclude" }, - { "$ref": "#/$defs/column_properties" } + { + "$ref": "#/$defs/include_exclude" + }, + { + "$ref": "#/$defs/column_properties" + } ] } } @@ -684,10 +669,7 @@ "type": "string" }, "constraints": { - "$ref": "#/$defs/array_of_strings" - }, - "constraints_check": { - "type": "string" + "$ref": "#/$defs/constraints" }, "data_type": { "type": "string" @@ -721,6 +703,33 @@ }, "additionalProperties": false }, + "constraints": { + "type": "array", + "items": { + "type": "object", + "required": ["type"], + "properties": { + "columns": { + "$ref": "#/$defs/string_or_array_of_strings" + }, + "expression": { + "type": "string" + }, + "name": { + "type": "string" + }, + "type": { + "type": "string" + }, + "warn_unenforced": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "warn_unsupported": { + "$ref": "#/$defs/boolean_or_jinja_string" + } + } + } + }, "freshness_definition": { "default": { "warn_after": { diff --git a/tests/valid/schema.yml b/tests/valid/schema.yml index c854455..277f4f3 100644 --- a/tests/valid/schema.yml +++ b/tests/valid/schema.yml @@ -32,9 +32,10 @@ models: description: "The primary key for this table" data_type: int constraints: - - "not null" - - "unique" - constraints_check: (id > 0) + - type: not_null + - type: unique + - type: check + expression: (id > 0) tests: - unique - not_null @@ -43,7 +44,7 @@ models: columns: - include: '*' exclude: country_name - - name: id # included in addition the '*' set. if customer_id were in the '*' set -> override it + - name: id # included in addition the '*' set. if id were in the '*' set -> override it description: This is the primary key data_type: float - v: 1 From 72bce91a49779cab69d44f35a58ce5c1b30c218e Mon Sep 17 00:00:00 2001 From: Dave Connors Date: Fri, 31 Mar 2023 08:58:12 -0500 Subject: [PATCH 13/13] update contract in project yml --- schemas/dbt_project.json | 16 ++++++++++++++-- tests/valid/dbt_project.yml | 4 ++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/schemas/dbt_project.json b/schemas/dbt_project.json index 72ad616..e848926 100644 --- a/schemas/dbt_project.json +++ b/schemas/dbt_project.json @@ -163,6 +163,18 @@ "type": "string" } }, + "contract": { + "type": "object", + "required": [ + "enforced" + ], + "properties": { + "enforced": { + "$ref": "#/$defs/boolean_or_jinja_string", + "default": "true" + } + } + }, "empty_directory": { "type": "null" }, @@ -255,7 +267,7 @@ "default": false }, "+contract": { - "$ref": "#/$defs/boolean_or_jinja_string" + "$ref": "#/$defs/contract" }, "+database": { "$ref": "#/$defs/database" @@ -313,7 +325,7 @@ "default": false }, "contract": { - "$ref": "#/$defs/boolean_or_jinja_string" + "$ref": "#/$defs/contract" }, "database": { "$ref": "#/$defs/database" diff --git a/tests/valid/dbt_project.yml b/tests/valid/dbt_project.yml index 4359074..d1f73c5 100644 --- a/tests/valid/dbt_project.yml +++ b/tests/valid/dbt_project.yml @@ -39,6 +39,10 @@ models: # same key without the plus materialized: table empty_subdirectory: + contracted_models: + +contract: + enforced: true + test_bq: +labels: key: val