diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ed983aa..8d66115 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,7 @@ jobs: test-against-sample-dbt-files: strategy: matrix: - dbt-version: ["1.5", "1.6"] + dbt-version: ["1.5", "1.6", "1.7"] dbt-file-name: ["dbt_project", "packages", "selectors", "dbt_yml_files", "dependencies", "dbt_cloud"] exclude: - dbt-version: "1.5" diff --git a/.vscode/settings.json b/.vscode/settings.json index 95581f3..641487d 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -48,6 +48,33 @@ ], "./schemas/1.6/dependencies-1.6.json": [ "/tests/1.6/**/dependencies.yml" + ], + "./schemas/1.7/dbt_yml_files-1.7.json": [ + "/tests/1.7/**/*.yml", + "!profiles.yml", + "!dbt_project.yml", + "!dbt_cloud.yml", + "!packages.yml", + "!selectors.yml", + "!dependencies.yml", + "!package-lock.yml", + "!profile_template.yml", + "!/.github/**/*.yml" + ], + "./schemas/1.7/dbt_project-1.7.json": [ + "/tests/1.7/**/dbt_project.yml" + ], + "./schemas/1.7/dbt_cloud-1.7.json": [ + "/tests/1.7/**/dbt_cloud.yml" + ], + "./schemas/1.7/selectors-1.7.json": [ + "/tests/1.7/**/selectors.yml" + ], + "./schemas/1.7/packages-1.7.json": [ + "/tests/1.7/**/packages.yml" + ], + "./schemas/1.7/dependencies-1.7.json": [ + "/tests/1.7/**/dependencies.yml" ] }, diff --git a/schemas/1.7/dbt_cloud-1.7.json b/schemas/1.7/dbt_cloud-1.7.json new file mode 100644 index 0000000..70921f0 --- /dev/null +++ b/schemas/1.7/dbt_cloud-1.7.json @@ -0,0 +1,14 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "project-id": { + "type": "string" + }, + "defer-env-id": { + "type": "string" + } + }, + "required": ["project-id"], + "additionalProperties": false +} diff --git a/schemas/1.7/dbt_project-1.7.json b/schemas/1.7/dbt_project-1.7.json new file mode 100644 index 0000000..4546889 --- /dev/null +++ b/schemas/1.7/dbt_project-1.7.json @@ -0,0 +1,951 @@ +{ + "title": "dbt_project", + "type": "object", + "required": ["name"], + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "version": { + "type": "string" + }, + "name": { + "type": "string" + }, + "analysis-paths": { + "$ref": "#/$defs/array_of_strings" + }, + "asset-paths": { + "$ref": "#/$defs/array_of_strings" + }, + "clean-targets": { + "$ref": "#/$defs/array_of_strings" + }, + "config-version": { + "type": "number", + "default": 2 + }, + "dbt-cloud": { + "type": "object", + "additionalProperties": true, + "properties": { + "project-id": { + "type": "number" + } + } + }, + "dispatch": { + "type": "array", + "items": { + "type": "object", + "required": ["macro_namespace", "search_order"], + "properties": { + "macro_namespace": { + "type": "string" + }, + "search_order": { + "$ref": "#/$defs/array_of_strings" + } + }, + "additionalProperties": false + } + }, + "docs-paths": { + "$ref": "#/$defs/array_of_strings" + }, + "log-path": { + "type": "string" + }, + "macro-paths": { + "$ref": "#/$defs/array_of_strings" + }, + "model-paths": { + "$ref": "#/$defs/array_of_strings" + }, + "models": { + "$ref": "#/$defs/model_configs" + }, + "on-run-end": { + "anyOf": [ + { + "$ref": "#/$defs/array_of_strings" + }, + { + "type": "string" + } + ] + }, + "on-run-start": { + "anyOf": [ + { + "$ref": "#/$defs/array_of_strings" + }, + { + "type": "string" + } + ] + }, + "packages-install-path": { + "type": "string" + }, + "profile": { + "type": "string" + }, + "query-comment": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "object", + "properties": { + "append": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "comment": { + "type": "string" + }, + "job-label": { + "$ref": "#/$defs/boolean_or_jinja_string" + } + }, + "additionalProperties": false + } + ] + }, + "quoting": { + "type": "object", + "properties": { + "database": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "identifier": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "schema": { + "$ref": "#/$defs/boolean_or_jinja_string" + } + } + }, + "require-dbt-version": { + "$ref": "#/$defs/string_or_array_of_strings" + }, + "seed-paths": { + "$ref": "#/$defs/array_of_strings" + }, + "seeds": { + "$ref": "#/$defs/seed_configs" + }, + "snapshot-paths": { + "$ref": "#/$defs/array_of_strings" + }, + "snapshots": { + "$ref": "#/$defs/snapshot_configs" + }, + "sources": { + "$ref": "#/$defs/source_configs" + }, + "target-path": { + "type": "string" + }, + "test-paths": { + "$ref": "#/$defs/array_of_strings" + }, + "tests": { + "$ref": "#/$defs/test_configs" + }, + "vars": { + "type": "object" + } + }, + "additionalProperties": false, + "$defs": { + "array_of_strings": { + "type": "array", + "items": { + "type": "string" + } + }, + "auto_refresh":{ + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "backup":{ + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "contract": { + "type": "object", + "required": ["enforced"], + "properties": { + "enforced": { + "$ref": "#/$defs/boolean_or_jinja_string", + "default": "true" + } + } + }, + "empty_directory": { + "type": "null" + }, + "boolean_or_jinja_string": { + "oneOf": [ + { + "$ref": "#/$defs/jinja_string" + }, + { + "type": "boolean" + } + ] + }, + "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 + }, + "invalidate_hard_deletes": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "jinja_string": { + "type": "string", + "pattern": "\\{\\{.*\\}\\}" + }, + "label_configs": { + "title": "Label configs", + "type": "object", + "description": "Configurations specific to BigQuery adapter used to add labels and tags to tables & views created by dbt.", + "patternProperties": { + "^[a-z][a-z0-9_-]{0,63}$": { + "oneOf": [ + { + "type": "string", + "pattern": "^[a-z0-9_-]{0,64}$" + }, + { + "$ref": "#/$defs/jinja_string" + } + ] + } + }, + "additionalProperties": false + }, + "model_configs": { + "title": "Model configs", + "type": "object", + "description": "Configurations set in the dbt_project.yml file will apply to all models that don't have a more specific configuration set.", + "properties": { + "+access":{ + "$ref": "#/$defs/access" + }, + "+alias": { + "$ref": "#/$defs/alias" + }, + "+auto_refresh":{ + "$ref": "#/$defs/auto_refresh" + }, + "+backup":{ + "$ref": "#/$defs/backup" + }, + "+bind": { + "$ref": "#/$defs/boolean_or_jinja_string", + "default": false + }, + "+contract": { + "$ref": "#/$defs/contract" + }, + "+copy_grants": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "+database": { + "$ref": "#/$defs/database" + }, + "+docs": { + "$ref": "#/$defs/docs_config" + }, + "+enabled": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "+grants": { + "$ref": "#/$defs/grants" + }, + "+file_format": { + "$ref": "#/$defs/file_format" + }, + "+grant_access_to": { + "$ref": "#/$defs/grant_access_to" + }, + "+group": { + "$ref": "#/$defs/group" + }, + "+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/label_configs" + }, + "+location": { + "$ref": "#/$defs/location" + }, + "+materialized": { + "$ref": "#/$defs/materialized" + }, + "+meta": { + "$ref": "#/$defs/meta" + }, + "+on_configuration_change": { + "$ref": "#/$defs/on_configuration_change" + }, + "+on_schema_change": { + "$ref": "#/$defs/on_schema_change" + }, + "+persist_docs": { + "$ref": "#/$defs/persist_docs_config" + }, + "+post-hook": { + "$ref": "#/$defs/array_of_strings" + }, + "+pre-hook": { + "$ref": "#/$defs/array_of_strings" + }, + "+schema": { + "$ref": "#/$defs/schema" + }, + "+sql_header": { + "$ref": "#/$defs/sql_header" + }, + "+snowflake_warehouse":{ + "$ref": "#/$defs/snowflake_warehouse" + }, + "+tags": { + "$ref": "#/$defs/string_or_array_of_strings" + }, + "+target_lag":{ + "$ref": "#/$defs/target_lag" + }, + "+transient": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "access":{ + "$ref": "#/$defs/access" + }, + "alias": { + "$ref": "#/$defs/alias" + }, + "auto_refresh":{ + "$ref": "#/$defs/auto_refresh" + }, + "backup":{ + "$ref": "#/$defs/backup" + }, + "bind": { + "$ref": "#/$defs/boolean_or_jinja_string", + "default": false + }, + "contract": { + "$ref": "#/$defs/contract" + }, + "copy_grants": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "database": { + "$ref": "#/$defs/database" + }, + "docs": { + "$ref": "#/$defs/docs_config" + }, + "enabled": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "grants": { + "$ref": "#/$defs/grants" + }, + "file_format": { + "$ref": "#/$defs/file_format" + }, + "grant_access_to": { + "$ref": "#/$defs/grant_access_to" + }, + "group": { + "$ref": "#/$defs/group" + }, + "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/label_configs" + }, + "location": { + "$ref": "#/$defs/location" + }, + "materialized": { + "$ref": "#/$defs/materialized" + }, + "meta": { + "$ref": "#/$defs/meta" + }, + "on_configuration_change": { + "$ref": "#/$defs/on_configuration_change" + }, + "on_schema_change": { + "$ref": "#/$defs/on_schema_change" + }, + "persist_docs": { + "$ref": "#/$defs/persist_docs_config" + }, + "post-hook": { + "$ref": "#/$defs/array_of_strings" + }, + "pre-hook": { + "$ref": "#/$defs/array_of_strings" + }, + "schema": { + "$ref": "#/$defs/schema" + }, + "snowflake_warehouse": { + "$ref": "#/$defs/snowflake_warehouse" + }, + "sql_header": { + "$ref": "#/$defs/sql_header" + }, + "tags": { + "$ref": "#/$defs/string_or_array_of_strings" + }, + "target_lag": { + "$ref": "#/$defs/target_lag" + }, + "transient": { + "$ref": "#/$defs/boolean_or_jinja_string" + } + }, + "additionalProperties": { + "oneOf": [ + { + "$ref": "#/$defs/model_configs" + }, + { + "$ref": "#/$defs/empty_directory" + } + ] + } + }, + "persist_docs_config": { + "title": "Persist docs config", + "type": "object", + "description": "Configurations for the persistence of the dbt documentation.", + "properties": { + "columns": { + "$ref": "#/$defs/boolean_or_jinja_string", + "default": true + }, + "relation": { + "$ref": "#/$defs/boolean_or_jinja_string", + "default": true + } + }, + "additionalProperties": false + }, + "seed_configs": { + "title": "Seed configs", + "type": "object", + "properties": { + "+copy_grants": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "+database": { + "$ref": "#/$defs/database" + }, + "+enabled": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "+grants": { + "$ref": "#/$defs/grants" + }, + "+group": { + "$ref": "#/$defs/group" + }, + "+meta": { + "$ref": "#/$defs/meta" + }, + "+persist_docs": { + "$ref": "#/$defs/persist_docs_config" + }, + "+quote_columns": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "+schema": { + "$ref": "#/$defs/schema" + }, + "+tags": { + "$ref": "#/$defs/string_or_array_of_strings" + }, + "+transient": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "+column_types": { + "$ref": "#/$defs/column_types" + }, + "+full_refresh": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "copy_grants": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "enabled": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "grants": { + "$ref": "#/$defs/grants" + }, + "group": { + "$ref": "#/$defs/group" + }, + "meta": { + "$ref": "#/$defs/meta" + }, + "persist_docs": { + "$ref": "#/$defs/persist_docs_config" + }, + "quote_columns": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "tags": { + "$ref": "#/$defs/string_or_array_of_strings" + }, + "transient": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "column_types": { + "$ref": "#/$defs/column_types" + }, + "full_refresh": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "database": { + "$ref": "#/$defs/database" + }, + "schema": { + "$ref": "#/$defs/schema" + } + }, + "additionalProperties": { + "oneOf": [ + { + "$ref": "#/$defs/seed_configs" + }, + { + "$ref": "#/$defs/empty_directory" + } + ] + } + }, + "snapshot_configs": { + "title": "Snapshot configs", + "type": "object", + "properties": { + "+alias": { + "$ref": "#/$defs/alias" + }, + "+check_cols": { + "$ref": "#/$defs/string_or_array_of_strings" + }, + "+enabled": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "+grants": { + "$ref": "#/$defs/grants" + }, + "+group": { + "$ref": "#/$defs/group" + }, + "+invalidate_hard_deletes": { + "$ref": "#/$defs/invalidate_hard_deletes" + }, + "+meta": { + "$ref": "#/$defs/meta" + }, + "+persist_docs": { + "$ref": "#/$defs/persist_docs_config" + }, + "+post-hook": { + "$ref": "#/$defs/array_of_strings" + }, + "+pre-hook": { + "$ref": "#/$defs/array_of_strings" + }, + "+quote_columns": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "+strategy": { + "$ref": "#/$defs/strategy" + }, + "+tags": { + "$ref": "#/$defs/string_or_array_of_strings" + }, + "+target_database": { + "$ref": "#/$defs/target_database" + }, + "+target_schema": { + "$ref": "#/$defs/target_schema" + }, + "+transient": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "+unique_key": { + "$ref": "#/$defs/string_or_array_of_strings" + }, + "+updated_at": { + "$ref": "#/$defs/updated_at" + }, + "alias": { + "$ref": "#/$defs/alias" + }, + "check_cols": { + "$ref": "#/$defs/string_or_array_of_strings" + }, + "enabled": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "grants": { + "$ref": "#/$defs/grants" + }, + "group": { + "$ref": "#/$defs/group" + }, + "invalidate_hard_deletes": { + "$ref": "#/$defs/invalidate_hard_deletes" + }, + "meta": { + "$ref": "#/$defs/meta" + }, + "persist_docs": { + "$ref": "#/$defs/persist_docs_config" + }, + "post-hook": { + "$ref": "#/$defs/array_of_strings" + }, + "pre-hook": { + "$ref": "#/$defs/array_of_strings" + }, + "quote_columns": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "strategy": { + "$ref": "#/$defs/strategy" + }, + "tags": { + "$ref": "#/$defs/string_or_array_of_strings" + }, + "target_database": { + "$ref": "#/$defs/target_database" + }, + "target_schema": { + "$ref": "#/$defs/target_schema" + }, + "transient": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "unique_key": { + "$ref": "#/$defs/string_or_array_of_strings" + }, + "updated_at": { + "$ref": "#/$defs/updated_at" + } + }, + "additionalProperties": { + "oneOf": [ + { + "$ref": "#/$defs/snapshot_configs" + }, + { + "$ref": "#/$defs/empty_directory" + } + ] + } + }, + "source_configs": { + "title": "Source configs", + "type": "object", + "properties": { + "+enabled": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "+meta": { + "$ref": "#/$defs/meta" + }, + "+tags": { + "$ref": "#/$defs/string_or_array_of_strings" + }, + "enabled": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "meta": { + "$ref": "#/$defs/meta" + }, + "tags": { + "$ref": "#/$defs/string_or_array_of_strings" + } + }, + "additionalProperties": { + "oneOf": [ + { + "$ref": "#/$defs/source_configs" + }, + { + "$ref": "#/$defs/empty_directory" + } + ] + } + }, + "string_or_array_of_strings": { + "oneOf": [ + { + "type": "string" + }, + { + "$ref": "#/$defs/array_of_strings" + } + ] + }, + "test_configs": { + "title": "Test configs", + "type": "object", + "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" + }, + "+database": { + "$ref": "#/$defs/database" + }, + "+enabled": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "+error_if": { + "$ref": "#/$defs/error_if" + }, + "+fail_calc": { + "$ref": "#/$defs/fail_calc" + }, + "+group": { + "$ref": "#/$defs/group" + }, + "+limit": { + "$ref": "#/$defs/limit" + }, + "+meta": { + "$ref": "#/$defs/meta" + }, + "+schema": { + "$ref": "#/$defs/schema" + }, + "+severity": { + "$ref": "#/$defs/severity" + }, + "+store_failures": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "+tags": { + "$ref": "#/$defs/string_or_array_of_strings" + }, + "+warn_if": { + "$ref": "#/$defs/warn_if" + }, + "enabled": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "error_if": { + "$ref": "#/$defs/error_if" + }, + "fail_calc": { + "$ref": "#/$defs/fail_calc" + }, + "group": { + "$ref": "#/$defs/group" + }, + "limit": { + "$ref": "#/$defs/limit" + }, + "meta": { + "$ref": "#/$defs/meta" + }, + "severity": { + "$ref": "#/$defs/severity" + }, + "store_failures": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "tags": { + "$ref": "#/$defs/string_or_array_of_strings" + }, + "warn_if": { + "$ref": "#/$defs/warn_if" + }, + "alias": { + "$ref": "#/$defs/alias" + }, + "database": { + "$ref": "#/$defs/database" + }, + "schema": { + "$ref": "#/$defs/schema" + } + }, + "additionalProperties": { + "oneOf": [ + { + "$ref": "#/$defs/test_configs" + }, + { + "$ref": "#/$defs/empty_directory" + } + ] + } + }, + "database": { + "type": "string" + }, + "file_format": { + "type": "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 + } + }, + "grants": { + "type": "object", + "description": "grant config. each key is a database permission and the value is the grantee of that permission", + "patternProperties": { + ".*": { + "$ref": "#/$defs/string_or_array_of_strings" + } + }, + "additionalProperties": false + }, + "group": { + "type": "string" + }, + "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." + }, + "location": { + "type": "string" + }, + "materialized": { + "type": "string" + }, + "meta": { + "type": "object" + }, + "on_configuration_change": { + "type": "string", + "enum": ["apply", "continue", "fail"] + }, + "on_schema_change": { + "type": "string", + "enum": ["append_new_columns", "fail", "ignore", "sync_all_columns"] + }, + "schema": { + "type": ["string", "null"] + }, + "sql_header": { + "type": "string" + }, + "column_types": { + "type": "object", + "patternProperties": { + "": { + "type": "string" + } + } + }, + "access": { + "type": "string", + "enum": ["private", "protected", "public"] + }, + "alias": { + "type": "string" + }, + "snowflake_warehouse": { + "type": "string" + }, + "strategy": { + "type": "string" + }, + "target_database": { + "type": "string" + }, + "target_lag": { + "type": "string", + "pattern": "^(?:downstream|\\d+\\s*(?:seconds|minutes|hours|days))$" + }, + "target_schema": { + "type": "string" + }, + "updated_at": { + "type": "string" + }, + "error_if": { + "type": "string" + }, + "fail_calc": { + "type": "string" + }, + "limit": { + "type": "number" + }, + "severity": { + "oneOf": [ + { + "$ref": "#/$defs/jinja_string" + }, + { + "type": "string", + "enum": ["warn", "error"] + } + ] + }, + "warn_if": { + "type": "string" + } + } +} diff --git a/schemas/1.7/dbt_yml_files-1.7.json b/schemas/1.7/dbt_yml_files-1.7.json new file mode 100644 index 0000000..c7f0c71 --- /dev/null +++ b/schemas/1.7/dbt_yml_files-1.7.json @@ -0,0 +1,1373 @@ +{ + "title": "dbt_yml_files", + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "version": { + "type": "number", + "const": 2 + }, + "analyses": { + "type": "array", + "items": { + "type": "object", + "required": ["name"], + "properties": { + "name": { + "type": "string" + }, + "columns": { + "type": "array", + "items": { + "type": "object", + "required": ["name"], + "properties": { + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "data_type": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "config": { + "type": "object", + "properties": { + "tags": { + "$ref": "#/$defs/string_or_array_of_strings" + } + }, + "additionalProperties": false + }, + "description": { + "type": "string" + }, + "docs": { + "$ref": "#/$defs/docs_config" + }, + "group": { + "$ref": "#/$defs/group" + } + } + } + }, + "exposures": { + "type": "array", + "items": { + "type": "object", + "required": ["depends_on", "name", "owner", "type"], + "$comment": "NB: depends_on is not strictly required, but is _expected_ according to the documentation", + "properties": { + "name": { + "type": "string" + }, + "label": { + "type": "string", + "$comment": "Added in dbt Core v1.3" + }, + "type": { + "type": "string", + "enum": ["dashboard", "notebook", "analysis", "ml", "application"] + }, + "depends_on": { + "type": "array", + "items": { + "type": "string" + } + }, + "description": { + "type": "string" + }, + "maturity": { + "type": "string", + "enum": ["high", "medium", "low"] + }, + "meta": { + "type": "object" + }, + "owner": { + "type": "object", + "required": ["email"], + "properties": { + "name": { + "type": "string" + }, + "email": { + "type": "string" + } + }, + "additionalProperties": false + }, + "tags": { + "$ref": "#/$defs/string_or_array_of_strings" + }, + "url": { + "type": "string" + } + } + } + }, + "groups": { + "type": "array", + "items": { + "type": "object", + "required": ["name", "owner"], + "properties": { + "name": { + "type": "string" + }, + "owner": { + "type": "object", + "minProperties": 1, + "properties": { + "name": { + "type": "string" + }, + "email": { + "type": "string" + } + }, + "additionalProperties": true + } + }, + "additionalProperties": false + } + }, + "macros": { + "type": "array", + "items": { + "type": "object", + "required": ["name"], + "properties": { + "name": { + "type": "string" + }, + "arguments": { + "type": "array", + "items": { + "type": "object", + "required": ["name"], + "properties": { + "name": { + "type": "string" + }, + "type": { + "type": "string" + }, + "description": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "description": { + "type": "string" + }, + "docs": { + "$ref": "#/$defs/docs_config" + } + }, + "additionalProperties": false + } + }, + "metrics": { + "type": "array", + "items": { + "type": "object", + "required": ["name", "label", "type", "type_params"], + "properties": { + "description": { + "type": "string" + }, + "filter": { + "type": "string" + }, + "group": { + "$ref": "#/$defs/group" + }, + "label": { + "type": "string" + }, + "name": { + "pattern": "(?!.*__).*^[a-z][a-z0-9_]*[a-z0-9]$", + "type": "string" + }, + "type": { + "enum": [ + "SIMPLE", + "RATIO", + "CUMULATIVE", + "DERIVED", + "simple", + "ratio", + "cumulative", + "derived" + ] + }, + "type_params": { + "$ref": "#/$defs/metric_type_params" + } + }, + "additionalProperties": false + } + }, + "models": { + "type": "array", + "items": { + "type": "object", + "required": ["name"], + "properties": { + "name": { + "type": "string" + }, + "access": { + "type": "string", + "enum": ["private", "protected", "public"] + }, + "columns": { + "type": "array", + "items": { + "$ref": "#/$defs/column_properties" + } + }, + "config": { + "$ref": "#/$defs/model_configs" + }, + "constraints": { + "$ref": "#/$defs/constraints" + }, + "description": { + "type": "string" + }, + "docs": { + "$ref": "#/$defs/docs_config" + }, + "group": { + "$ref": "#/$defs/group" + }, + "latest_version": { + "type": "number" + }, + "meta": { + "type": "object" + }, + "tests": { + "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": "array", + "items": { + "anyOf": [ + { + "$ref": "#/$defs/include_exclude" + }, + { + "$ref": "#/$defs/column_properties" + } + ] + } + } + } + } + } + }, + "additionalProperties": false + } + }, + "seeds": { + "type": "array", + "items": { + "type": "object", + "required": ["name"], + "properties": { + "name": { + "type": "string" + }, + "columns": { + "type": "array", + "items": { + "$ref": "#/$defs/column_properties" + } + }, + "config": { + "type": "object", + "properties": { + "column_types": { + "type": "object" + }, + "copy_grants": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "database": { + "type": "string" + }, + "enabled": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "grants": { + "$ref": "#/$defs/grants" + }, + "quote_columns": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "schema": { + "type": "string" + } + } + }, + "description": { + "type": "string" + }, + "docs": { + "$ref": "#/$defs/docs_config" + }, + "group": { + "$ref": "#/$defs/group" + }, + "tests": { + "type": "array", + "items": { + "$ref": "#/$defs/tests" + } + } + }, + "additionalProperties": false + } + }, + "semantic_models": { + "type": "array", + "items": { + "type": "object", + "required": ["name", "model"], + "properties": { + "defaults": { + "type": "object", + "properties": { + "agg_time_dimension": { + "type": "string" + } + }, + "additionalProperties": false + }, + "description": { + "type": "string" + }, + "dimensions": { + "type": "array", + "items": { + "$ref": "#/$defs/dimension" + } + }, + "entities": { + "type": "array", + "items": { + "$ref": "#/$defs/entity" + } + }, + "measures": { + "type": "array", + "items": { + "$ref": "#/$defs/measure" + } + }, + "model": { + "type": "string", + "default": "ref('')" + }, + "name": { + "pattern": "(?!.*__).*^[a-z][a-z0-9_]*[a-z0-9]$", + "type": "string" + }, + "primary_entity": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "snapshots": { + "type": "array", + "items": { + "type": "object", + "required": ["name"], + "properties": { + "name": { + "type": "string" + }, + "columns": { + "type": "array", + "items": { + "$ref": "#/$defs/column_properties" + } + }, + "config": { + "type": "object", + "properties": { + "alias": { + "type": "string" + }, + "check_cols": { + "$ref": "#/$defs/string_or_array_of_strings" + }, + "enabled": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "grants": { + "$ref": "#/$defs/grants" + }, + "persist_docs": { + "$ref": "#/$defs/persist_docs_config" + }, + "post-hook": { + "$ref": "#/$defs/array_of_strings" + }, + "pre-hook": { + "$ref": "#/$defs/array_of_strings" + }, + "quote_columns": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "strategy": { + "type": "string" + }, + "tags": { + "$ref": "#/$defs/string_or_array_of_strings" + }, + "target_database": { + "type": "string" + }, + "target_schema": { + "type": "string" + }, + "unique_key": { + "$ref": "#/$defs/string_or_array_of_strings" + }, + "updated_at": { + "type": "string" + } + } + }, + "description": { + "type": "string" + }, + "docs": { + "$ref": "#/$defs/docs_config" + }, + "group": { + "$ref": "#/$defs/group" + }, + "meta": { + "type": "object" + }, + "tests": { + "type": "array", + "items": { + "$ref": "#/$defs/tests" + } + } + }, + "additionalProperties": false + } + }, + "sources": { + "type": "array", + "items": { + "type": "object", + "required": ["name"], + "properties": { + "name": { + "type": "string", + "description": "How you will identify the schema in {{ source() }} calls. Unless `schema` is also set, this will be the name of the schema in the database." + }, + "config": { + "type": "object" + }, + "database": { + "type": "string" + }, + "description": { + "type": "string" + }, + "freshness": { + "$ref": "#/$defs/freshness_definition" + }, + "loaded_at_field": { + "type": "string" + }, + "loader": { + "type": "string" + }, + "meta": { + "type": "object" + }, + "overrides": { + "title": "Package to Override", + "type": "string", + "description": "The name of another package installed in your project. If that package has a source with the same name as this one, its properties will be applied on top of the base properties of the overridden source. https://docs.getdbt.com/reference/resource-properties/overrides" + }, + "quoting": { + "type": "object", + "properties": { + "database": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "identifier": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "schema": { + "$ref": "#/$defs/boolean_or_jinja_string" + } + }, + "additionalProperties": false + }, + "schema": { + "type": "string", + "description": "The schema name as stored in the database. Only needed if you want to use a different `name` than what exists in the database (otherwise `name` is used by default)" + }, + "tables": { + "type": "array", + "items": { + "type": "object", + "required": ["name"], + "properties": { + "name": { + "title": "Name", + "type": "string", + "description": "How you will identify the table in {{ source() }} calls. Unless `identifier` is also set, this will be the name of the table in the database." + }, + "columns": { + "type": "array", + "items": { + "$ref": "#/$defs/column_properties" + } + }, + "description": { + "type": "string" + }, + "external": { + "type": "object" + }, + "freshness": { + "$ref": "#/$defs/freshness_definition" + }, + "identifier": { + "title": "Identifier", + "type": "string", + "description": "The table name as stored in the database. Only needed if you want to give the source a different name than what exists in the database (otherwise `name` is used by default)" + }, + "loaded_at_field": { + "type": "string", + "description": "Which column to check during data freshness tests. Only needed if the table has a different loaded_at_field to the one defined on the source overall." + }, + "loader": { + "type": "string" + }, + "meta": { + "type": "object" + }, + "quoting": { + "type": "object", + "properties": { + "database": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "identifier": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "schema": { + "$ref": "#/$defs/boolean_or_jinja_string" + } + }, + "additionalProperties": false + }, + "tags": { + "$ref": "#/$defs/string_or_array_of_strings" + }, + "tests": { + "type": "array", + "items": { + "$ref": "#/$defs/tests" + } + } + }, + "additionalProperties": false + } + }, + "tags": { + "$ref": "#/$defs/string_or_array_of_strings" + }, + "tests": { + "type": "array", + "items": { + "$ref": "#/$defs/tests" + } + } + } + } + } + }, + "additionalProperties": false, + "$defs": { + "aggregation_type_params": { + "type": "object", + "properties": { + "percentile": { + "type": "number" + }, + "use_approximate_percentile": { + "type": "boolean" + }, + "use_discrete_percentile": { + "type": "boolean" + } + }, + "additionalProperties": false + }, + "array_of_strings": { + "type": "array", + "items": { + "type": "string" + } + }, + "boolean_or_jinja_string": { + "oneOf": [ + { + "$ref": "#/$defs/jinja_string" + }, + { + "type": "boolean" + } + ], + "additionalProperties": false + }, + "column_properties": { + "type": "object", + "required": ["name"], + "properties": { + "name": { + "type": "string" + }, + "constraints": { + "$ref": "#/$defs/constraints" + }, + "data_type": { + "type": "string" + }, + "description": { + "type": "string" + }, + "meta": { + "type": "object" + }, + "policy_tags": { + "title": "Policy tags", + "type": "array", + "description": "Configurations, specific to BigQuery adapter, used to set policy tags on specific columns, enabling column-level security. Only relevant when `persist_docs.columns` is true.", + "items": { + "type": "string" + } + }, + "quote": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "tests": { + "type": "array", + "items": { + "$ref": "#/$defs/tests" + } + }, + "tags": { + "$ref": "#/$defs/string_or_array_of_strings" + } + }, + "additionalProperties": false, + "uniqueItems": true + }, + "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" + } + } + } + }, + "dimension": { + "type": "object", + "required": ["name", "type"], + "anyOf": [ + { + "not": { + "$ref": "#/$defs/is-time-dimension" + } + }, + { + "required": ["type_params"] + } + ], + "properties": { + "description": { + "type": "string" + }, + "expr": { + "type": ["string", "boolean"] + }, + "is_partition": { + "type": "boolean" + }, + "name": { + "pattern": "(?!.*__).*^[a-z][a-z0-9_]*[a-z0-9]$", + "type": "string" + }, + "type": { + "enum": ["CATEGORICAL", "TIME", "categorical", "time"] + }, + "type_params": { + "$ref": "#/$defs/dimension_type_params" + } + }, + "additionalProperties": false + }, + "dimension_type_params": { + "type": "object", + "required": ["time_granularity"], + "properties": { + "time_granularity": { + "enum": [ + "DAY", + "WEEK", + "MONTH", + "QUARTER", + "YEAR", + "day", + "week", + "month", + "quarter", + "year" + ] + }, + "validity_params": { + "$ref": "#/$defs/validity_params" + } + }, + "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", + "properties": { + "entity": { + "type": "string" + }, + "expr": { + "type": ["string", "boolean"] + }, + "name": { + "pattern": "(?!.*__).*^[a-z][a-z0-9_]*[a-z0-9]$", + "type": "string" + }, + "role": { + "type": "string" + }, + "type": { + "enum": [ + "PRIMARY", + "UNIQUE", + "FOREIGN", + "NATURAL", + "primary", + "unique", + "foreign", + "natural" + ] + } + }, + "additionalProperties": false + }, + "freshness_definition": { + "default": { + "warn_after": { + "count": 1, + "period": "day" + }, + "error_after": { + "count": 2, + "period": "day" + } + }, + "oneOf": [ + { + "type": "object", + "properties": { + "error_after": { + "$ref": "#/$defs/freshness_rules" + }, + "filter": { + "type": "string" + }, + "warn_after": { + "$ref": "#/$defs/freshness_rules" + } + }, + "additionalProperties": false + }, + { + "const": null + } + ] + }, + "freshness_rules": { + "type": "object", + "required": ["count", "period"], + "properties": { + "count": { + "$ref": "#/$defs/number_or_jinja_string" + }, + "period": { + "type": "string", + "enum": ["minute", "hour", "day"] + } + }, + "additionalProperties": false + }, + "grants": { + "type": "object", + "description": "grant config. each key is a database permission and the value is the grantee of that permission", + "patternProperties": { + ".*": { + "$ref": "#/$defs/string_or_array_of_strings" + } + }, + "additionalProperties": false + }, + "group": { + "type": "string" + }, + "include_exclude": { + "type": "object", + "properties": { + "include": { + "$ref": "#/$defs/string_or_array_of_strings" + }, + "exclude": { + "$ref": "#/$defs/string_or_array_of_strings" + } + } + }, + "is-time-dimension": { + "properties": { + "type": { + "enum": ["TIME", "time"] + } + }, + "required": ["type"] + }, + "jinja_string": { + "type": "string", + "pattern": "\\{\\{.*\\}\\}" + }, + "measure": { + "required": ["name", "agg"], + "type": "object", + "properties": { + "agg": { + "enum": [ + "SUM", + "MIN", + "MAX", + "AVERAGE", + "COUNT_DISTINCT", + "SUM_BOOLEAN", + "COUNT", + "PERCENTILE", + "MEDIAN", + "sum", + "min", + "max", + "average", + "count_distinct", + "sum_boolean", + "count", + "percentile", + "median" + ] + }, + "agg_params": { + "$ref": "#/$defs/aggregation_type_params" + }, + "agg_time_dimension": { + "pattern": "(?!.*__).*^[a-z][a-z0-9_]*[a-z0-9]$", + "type": "string" + }, + "create_metric": { + "type": "boolean" + }, + "create_metric_display_name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "expr": { + "type": ["string", "integer", "boolean"] + }, + "name": { + "pattern": "(?!.*__).*^[a-z][a-z0-9_]*[a-z0-9]$", + "type": "string" + }, + "non_additive_dimension": { + "$ref": "#/$defs/non_additive_dimension" + } + }, + "additionalProperties": false + }, + "metric_input_measure": { + "oneOf": [ + { + "type": "string" + }, + { + "additionalProperties": false, + "properties": { + "alias": { + "type": "string" + }, + "filter": { + "type": "string" + }, + "name": { + "type": "string" + } + }, + "type": "object" + } + ] + }, + "metric_input_schema": { + "type": "object", + "properties": { + "alias": { + "type": "string" + }, + "filter": { + "type": "string" + }, + "name": { + "type": "string" + }, + "offset_to_grain": { + "type": "string" + }, + "offset_window": { + "type": "string" + } + }, + "additionalProperties": false + }, + "metric_type_params": { + "type": "object", + "properties": { + "denominator": { + "$ref": "#/$defs/metric_input_measure" + }, + "expr": { + "type": ["string", "boolean"] + }, + "grain_to_date": { + "type": "string" + }, + "measure": { + "$ref": "#/$defs/metric_input_measure" + }, + "metrics": { + "items": { + "$ref": "#/$defs/metric_input_schema" + }, + "type": "array" + }, + "numerator": { + "$ref": "#/$defs/metric_input_measure" + }, + "window": { + "type": "string" + } + }, + "additionalProperties": false + }, + "model_configs": { + "type": "object", + "properties": { + "auto_refresh": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "backup": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "contract": { + "type": "object", + "properties": { + "enforced": { + "$ref": "#/$defs/boolean_or_jinja_string" + } + } + }, + "file_format": { + "type": "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 + } + }, + "grants": { + "$ref": "#/$defs/grants" + }, + "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 + }, + "location": { + "type": "string" + }, + "materialized": { + "type": "string" + }, + "on_configuration_change": { + "type": "string", + "enum": ["apply", "continue", "fail"] + }, + "on_schema_change": { + "type": "string", + "enum": ["append_new_columns", "fail", "ignore", "sync_all_columns"] + }, + "sql_header": { + "type": "string" + }, + "snowflake_warehouse":{ + "type": "string" + }, + "target_lag":{ + "type": "string", + "pattern": "^(?:downstream|\\d+\\s*(?:seconds|minutes|hours|days))$" + } + } + }, + "non_additive_dimension": { + "type": "object", + "required": ["name"], + "properties": { + "name": { + "type": "string" + }, + "window_choice": { + "enum": ["MIN", "MAX", "min", "max"] + }, + "window_groupings": { + "items": { + "type": "string" + }, + "type": "array" + } + }, + "additionalProperties": false + }, + "number_or_jinja_string": { + "oneOf": [ + { + "$ref": "#/$defs/jinja_string" + }, + { + "type": "number" + } + ], + "additionalProperties": false + }, + "persist_docs_config": { + "title": "Persist docs config", + "type": "object", + "description": "Configurations for the persistence of the dbt documentation.", + "properties": { + "columns": { + "$ref": "#/$defs/boolean_or_jinja_string", + "default": true + }, + "relation": { + "$ref": "#/$defs/boolean_or_jinja_string", + "default": true + } + }, + "additionalProperties": false + }, + "string_or_array_of_strings": { + "oneOf": [ + { + "type": "string" + }, + { + "$ref": "#/$defs/array_of_strings" + } + ] + }, + "test_configs": { + "title": "Test configs", + "type": "object", + "description": "Configurations set here will override configs set in dbt_project.yml.", + "properties": { + "alias": { + "type": "string", + "description": "Only relevant when `store_failures` is true" + }, + "database": { + "type": "string", + "description": "Only relevant when `store_failures` is true" + }, + "enabled": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "error_if": { + "type": "string" + }, + "fail_calc": { + "type": "string" + }, + "limit": { + "type": "number" + }, + "schema": { + "type": "string", + "description": "Only relevant when `store_failures` is true" + }, + "severity": { + "oneOf": [ + { + "$ref": "#/$defs/jinja_string" + }, + { + "type": "string", + "enum": ["warn", "error"] + } + ] + }, + "store_failures": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "tags": { + "$ref": "#/$defs/string_or_array_of_strings" + }, + "warn_if": { + "type": "string" + } + } + }, + "tests": { + "anyOf": [ + { + "type": "string" + }, + { + "title": "Relationships Test", + "type": "object", + "properties": { + "relationships": { + "type": "object", + "required": ["to", "field"], + "properties": { + "name": { + "type": "string" + }, + "config": { + "$ref": "#/$defs/test_configs" + }, + "field": { + "title": "Relationships: Field", + "type": "string", + "default": "", + "description": "The foreign key column" + }, + "to": { + "type": "string", + "default": "ref('')", + "examples": [ + "ref('parent_model')", + "source('parent_schema', 'parent_table')" + ] + }, + "where": { + "type": "string" + } + } + } + } + }, + { + "title": "Accepted Values Test", + "type": "object", + "properties": { + "accepted_values": { + "type": "object", + "required": ["values"], + "properties": { + "name": { + "type": "string" + }, + "config": { + "$ref": "#/$defs/test_configs" + }, + "quote": { + "type": "boolean" + }, + "values": { + "type": "array", + "items": { + "type": "string" + } + }, + "where": { + "type": "string" + } + } + } + } + }, + { + "title": "Not Null Test", + "type": "object", + "properties": { + "not_null": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "config": { + "$ref": "#/$defs/test_configs" + }, + "where": { + "type": "string" + } + } + } + } + }, + { + "title": "Unique Test", + "type": "object", + "properties": { + "unique": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "config": { + "$ref": "#/$defs/test_configs" + }, + "where": { + "type": "string" + } + } + } + } + } + ] + }, + "validity_params": { + "type": "object", + "properties": { + "is_end": { + "type": "boolean" + }, + "is_start": { + "type": "boolean" + } + }, + "additionalProperties": false + } + } +} diff --git a/schemas/1.7/dependencies-1.7.json b/schemas/1.7/dependencies-1.7.json new file mode 100644 index 0000000..b17802a --- /dev/null +++ b/schemas/1.7/dependencies-1.7.json @@ -0,0 +1,83 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "title": "dependencies", + "properties": { + "projects": { + "type": "array", + "items": { + "type": "object", + "required": ["name"], + "properties": { + "name": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "packages": { + "type": "array", + "items": { + "anyOf": [ + { + "type": "object", + "required": ["package", "version"], + "properties": { + "version": { + "title": "Package version", + "type": ["string", "number", "array"], + "description": "A semantic version string or range, such as [\">=1.0.0\", \"<2.0.0\"]" + }, + "install-prerelease": { + "title": "Install Prerelease", + "type": "boolean", + "description": "Opt in to prerelease versions of a package" + }, + "package": { + "title": "Package identifier", + "type": "string", + "description": "Must be in format `org_name/package_name`. Refer to hub.getdbt.com for installation instructions", + "examples": ["dbt-labs/dbt_utils"], + "pattern": "^[\\w\\-\\.]+/[\\w\\-\\.]+$" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": ["git"], + "properties": { + "git": { + "title": "Git URL", + "type": "string" + }, + "revision": { + "title": "Revision", + "type": "string", + "description": "Pin your package to a specific release by specifying a release name" + }, + "subdirectory": { + "title": "Subdirectory", + "type": "string", + "description": "Only required if the package is nested in a subdirectory of the git project" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "local": { + "type": "string" + } + }, + "additionalProperties": false + } + ] + }, + "minItems": 1 + } + }, + "additionalProperties": false +} diff --git a/schemas/1.7/packages-1.7.json b/schemas/1.7/packages-1.7.json new file mode 100644 index 0000000..86cc8a9 --- /dev/null +++ b/schemas/1.7/packages-1.7.json @@ -0,0 +1,84 @@ +{ + "title": "packages", + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "required": [ + "packages" + ], + "properties": { + "packages": { + "type": "array", + "items": { + "anyOf": [ + { + "type": "object", + "required": [ + "package", + "version" + ], + "properties": { + "version": { + "title": "Package version", + "type": [ + "string", + "number", + "array" + ], + "description": "A semantic version string or range, such as [\">=1.0.0\", \"<2.0.0\"]" + }, + "install-prerelease": { + "title": "Install Prerelease", + "type": "boolean", + "description": "Opt in to prerelease versions of a package" + }, + "package": { + "title": "Package identifier", + "type": "string", + "description": "Must be in format `org_name/package_name`. Refer to hub.getdbt.com for installation instructions", + "examples": [ + "dbt-labs/dbt_utils" + ], + "pattern": "^[\\w\\-\\.]+/[\\w\\-\\.]+$" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "git" + ], + "properties": { + "git": { + "title": "Git URL", + "type": "string" + }, + "revision": { + "title": "Revision", + "type": "string", + "description": "Pin your package to a specific release by specifying a release name" + }, + "subdirectory": { + "title": "Subdirectory", + "type": "string", + "description": "Only required if the package is nested in a subdirectory of the git project" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "local": { + "type": "string" + } + }, + "additionalProperties": false + } + ] + }, + "minItems": 1 + } + }, + "additionalProperties": false +} diff --git a/schemas/1.7/selectors-1.7.json b/schemas/1.7/selectors-1.7.json new file mode 100644 index 0000000..7c818d7 --- /dev/null +++ b/schemas/1.7/selectors-1.7.json @@ -0,0 +1,153 @@ +{ + "title": "selectors", + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "required": [ + "selectors" + ], + "properties": { + "selectors": { + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": { + "oneOf": [ + { + "type": "string", + "pattern": "\\{\\{.*\\}\\}" + }, + { + "type": "boolean" + } + ], + "additionalProperties": false + }, + "definition": { + "oneOf": [ + { + "$ref": "#/$defs/definition_block" + }, + { + "type": "string" + }, + { + "$ref": "#/$defs/union_block" + } + ] + } + }, + "additionalProperties": false + }, + "minItems": 1 + } + }, + "additionalProperties": false, + "$defs": { + "boolean_or_jinja_string": { + "oneOf": [ + { + "$ref": "#/$defs/jinja_string" + }, + { + "type": "boolean" + } + ], + "additionalProperties": false + }, + "definition_block": { + "type": "object", + "properties": { + "method": { + "type": "string", + "enum": [ + "tag", + "source", + "path", + "file", + "fqn", + "package", + "config", + "test_type", + "test_name", + "state", + "exposure", + "metric", + "result", + "source_status", + "group", + "wildcard" + ] + }, + "value": { + "type": "string" + }, + "children": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "parents": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "children_depth": { + "type": "number" + }, + "parents_depth": { + "type": "number" + }, + "childrens_parents": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "indirect_selection": { + "type": "string", + "enum": ["buildable", "cautious", "eager"] + } + }, + "additionalProperties": true + }, + "exclude_block": { + "type": "array", + "items": { + "anyOf": [ + { + "$ref": "#/$defs/intersection_block" + }, + { + "$ref": "#/$defs/definition_block" + } + ] + } + }, + "intersection_block": { + "type": "array", + "items": { + "$ref": "#/$defs/definition_block" + } + }, + "jinja_string": { + "type": "string", + "pattern": "\\{\\{.*\\}\\}" + }, + "union_block": { + "type": "array", + "items": { + "anyOf": [ + { + "$ref": "#/$defs/intersection_block" + }, + { + "$ref": "#/$defs/definition_block" + }, + { + "$ref": "#/$defs/exclude_block" + } + ] + } + } + } +} diff --git a/tests/1.7/invalid/dbt_cloud.yml b/tests/1.7/invalid/dbt_cloud.yml new file mode 100644 index 0000000..80e214d --- /dev/null +++ b/tests/1.7/invalid/dbt_cloud.yml @@ -0,0 +1 @@ +dave-loves-dbt: true diff --git a/tests/1.7/invalid/dbt_project.yml b/tests/1.7/invalid/dbt_project.yml new file mode 100644 index 0000000..a0f0475 --- /dev/null +++ b/tests/1.7/invalid/dbt_project.yml @@ -0,0 +1,67 @@ +# this file was generated with dbt init with dbt 1.2.1 + +# Name your project! Project names should contain only lowercase characters +# and underscores. A good package name should reflect your organization's +# name or the intended use of these models +name: 'test' +version: '1.0.0' +config-version: 2 + +# This setting configures which "profile" dbt uses for this project. +profile: 'test' + +# These configurations specify where dbt should look for different types of files. +# The `model-paths` config, for example, states that models in this project can be +# found in the "models/" directory. You probably won't need to change these! +model-paths: ["models"] +analysis-paths: ["analyses"] +test-paths: ["tests"] +seed-paths: ["seeds"] +macro-paths: ["macros"] +snapshot-paths: ["snapshots"] + +target-path: "target" # directory which will store compiled SQL files +clean-targets: # directories to be removed by `dbt clean` + - "target" + - "dbt_packages" + + +# Configuring models +# Full documentation: https://docs.getdbt.com/docs/configuring-models + +# In this example config, we tell dbt to build all models in the example/ directory +# as tables. These settings can be overridden in the individual model files +# using the `{{ config(...) }}` macro. +models: + test: + # Config indicated by + and applies to all files under models/example/ + example: + +materialized: view + +bogus_key: true + bogus_key_no_plus: "shonuff" + +grants: + no_numbers: 55 + + materialized_views: + materialized: materialized_view + config: + target_lag: 1 hour + snowflake_warehouse: 11 + + +seeds: + test: + +enabled: false + +tests: + test: + +enabled: never + +severity: plaid + +semantic_models: + test: + +enabled: false + +metrics: + test: + invalid: true \ No newline at end of file diff --git a/tests/1.7/invalid/dbt_yml_files.yml b/tests/1.7/invalid/dbt_yml_files.yml new file mode 100644 index 0000000..9f0940a --- /dev/null +++ b/tests/1.7/invalid/dbt_yml_files.yml @@ -0,0 +1,67 @@ +# this file was generated with dbt init with dbt 1.2.1 + +version: 2 + +models: + - name: my_first_dbt_model + description: "A starter dbt model" + jarrod: saltalamachhia + columns: + - name: id + description: "The primary key for this table" + nomar: garciaparra + tests: + - unique + - not_null + + - name: my_second_dbt_model + description: "A starter dbt model" + columns: + - name: id + description: "The primary key for this table" + tests: + - unique + - not_null + +semantic_models: + - model: ref('models') + name: model + group: farmhands_only + +metrics: + - name: new_customers + label: New Customers marked 'paying' + model: ref('dim_model_7') + description: "The number of paid customers using the product" + + calculation_method: count + expression: user_id # superfluous here, but shown as an example + + timestamp: signup_date + time_grains: [day, week, month] + + dimensions: + - plan + - country + + filters: + - field: is_paying + operator: '=' + value: 'true' + - field: company_name + operator: '!=' + value: "Acme', Inc" + + meta: + team: "Finance" + refresh_rate: "Bob's weekly run" + + invalid_key: true + + + - name: derived_with_model_name + label: New Customers marked 'paying' + description: "The number of paid customers using the product" + + calculation_method: derived + expression: "{{ metric('new_customers') }} * 2" \ No newline at end of file diff --git a/tests/1.7/invalid/dependencies.yml b/tests/1.7/invalid/dependencies.yml new file mode 100644 index 0000000..08bb75c --- /dev/null +++ b/tests/1.7/invalid/dependencies.yml @@ -0,0 +1,6 @@ +projects: + - gnome: my_dbt_project + +pancakeages: + - pancake: dbt-labs/dbt-utils + version: 1.0.0 \ No newline at end of file diff --git a/tests/1.7/invalid/packages.yml b/tests/1.7/invalid/packages.yml new file mode 100644 index 0000000..54f02c4 --- /dev/null +++ b/tests/1.7/invalid/packages.yml @@ -0,0 +1,8 @@ +packages: + - package: dbt-labs/dbt-utils + version_number: 1.0.0 + + - git_address: "https://github.com/dbt-labs/dbt-utils.git" + revision: 0.9.2 + + - local_path: /opt/dbt/redshift \ No newline at end of file diff --git a/tests/1.7/invalid/selectors.yml b/tests/1.7/invalid/selectors.yml new file mode 100644 index 0000000..a21a0e2 --- /dev/null +++ b/tests/1.7/invalid/selectors.yml @@ -0,0 +1,8 @@ +selector: + - name: nodes_to_joy + definition: + method_of_attack: tag + value: nightly + dont_include: + - "@tag:daily" + diff --git a/tests/1.7/valid/dbt_cloud.yml b/tests/1.7/valid/dbt_cloud.yml new file mode 100644 index 0000000..0742ac6 --- /dev/null +++ b/tests/1.7/valid/dbt_cloud.yml @@ -0,0 +1 @@ +project-id: '672' \ No newline at end of file diff --git a/tests/1.7/valid/dbt_project.yml b/tests/1.7/valid/dbt_project.yml new file mode 100644 index 0000000..cf2b88a --- /dev/null +++ b/tests/1.7/valid/dbt_project.yml @@ -0,0 +1,106 @@ +# this file was generated with dbt init with dbt 1.2.1 + +# Name your project! Project names should contain only lowercase characters +# and underscores. A good package name should reflect your organization's +# name or the intended use of these models +name: 'test' + +# This setting configures which "profile" dbt uses for this project. +profile: 'test' + +# These configurations specify where dbt should look for different types of files. +# The `model-paths` config, for example, states that models in this project can be +# found in the "models/" directory. You probably won't need to change these! +model-paths: ["models"] +analysis-paths: ["analyses"] +test-paths: ["tests"] +seed-paths: ["seeds"] +macro-paths: ["macros"] +snapshot-paths: ["snapshots"] + +target-path: "target" # directory which will store compiled SQL files +clean-targets: # directories to be removed by `dbt clean` + - "target" + - "dbt_packages" + + +# Configuring models +# Full documentation: https://docs.getdbt.com/docs/configuring-models + +# In this example config, we tell dbt to build all models in the example/ directory +# as tables. These settings can be overridden in the individual model files +# using the `{{ config(...) }}` macro. +dbt-cloud: + project-id: 12345 + extra: true + +models: + test: + # Config indicated by + and applies to all files under models/example/ + example: + +materialized: view + subdirectory: + # same key without the plus + materialized: table + empty_subdirectory: + another_one: + +group: real + meta: + owner: Tony + contracted_models: + +contract: + enforced: true + granted_models: + +grants: + privilege: role + privileges: ["select_user", "select_cruiser"] + materialized_views: + +materialized: materialized_view + +auto_refresh: true + +backup: '{{ target.name == "prod" }}' + +target_lag: 20 minutes + +snowflake_warehouse: my_warehouse + + test_bq: + +labels: + key: val + jinja_key: "{{ target.name }}" + +seeds: + test: + +enabled: false + empty_subdirectory: + +tests: + test1: + +enabled: true + +severity: warn + empty_subdirectory: + test2: + +enabled: false + +severity: error + empty_subdirectory: + test3: + +enabled: "{{ env_var('DBT_ENABLE_TESTS', 'error') }}" + +severity: "{{ env_var('DBT_TEST_SEVERITY', 'error') }}" + empty_subdirectory: + +snapshots: + test: + +target_schema: schema + +target_database: database + +invalidate_hard_deletes: true + +grants: + select: ['role'] + + empty_subdirectory: + +sources: + test: + +enabled: true + empty_subdirectory: + +quoting: + database: true + schema: true + identifier: true diff --git a/tests/1.7/valid/dbt_yml_files.yml b/tests/1.7/valid/dbt_yml_files.yml new file mode 100644 index 0000000..425c19c --- /dev/null +++ b/tests/1.7/valid/dbt_yml_files.yml @@ -0,0 +1,148 @@ +# this file was generated with dbt init with dbt 1.2.1 + +models: + - name: my_first_dbt_model + description: "A starter dbt model" + config: + grants: + privilege: role + privileges: ["select_user", "select_cruiser"] + columns: + - name: id + description: "The primary key for this table" + tests: + - unique + - not_null + + - 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" + tests: + - unique + - not_null + + - name: my_contracted_dbt_model + 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: + - type: not_null + - type: unique + - type: check + expression: (id > 0) + tests: + - unique + - not_null + versions: + - v: 2 + columns: + - include: '*' + exclude: country_name + - 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 + 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 + + - name: my_materialized_view + config: + materialized: materialized_view + auto_refresh: true + backup: '{{ target.name == "prod" }}' + target_lag: downstream + snowflake_warehouse: my_warehouse + +snapshots: + - name: snapshot_name + group: analytics + description: slowly changing dimension + columns: + - name: id + description: cool column, eh? + + +# model groups + +groups: + - name: analytics + owner: + name: dave + +semantic_models: + - name: customers + defaults: + agg_time_dimension: first_ordered_at + description: | + Customer grain mart. + model: ref('customers') + entities: + - name: customer + expr: customer_id + type: primary + dimensions: + - name: customer_name + type: categorical + - name: customer_type + type: categorical + - name: first_ordered_at + type: time + type_params: + time_granularity: day + - name: last_ordered_at + type: time + type_params: + time_granularity: day + measures: + - name: count_lifetime_orders + description: Total count of orders per customer. + agg: sum + - name: lifetime_spend_pretax + description: Customer lifetime spend before taxes. + agg: sum + - name: lifetime_spend + agg: sum + description: Gross customer lifetime spend inclusive of taxes. + +metrics: + # Simple metrics + - name: customers_with_orders + description: "Distict count of customers placing orders" + type: simple + label: Customers w/ Orders + type_params: + measure: customers_with_orders + - name: new_customer + description: Unique count of new customers. + label: New Customers + type: simple + type_params: + measure: customers_with_orders + filter: | + {{ Dimension('customer__customer_type') }} = 'new' \ No newline at end of file diff --git a/tests/1.7/valid/dependencies.yml b/tests/1.7/valid/dependencies.yml new file mode 100644 index 0000000..19c88c5 --- /dev/null +++ b/tests/1.7/valid/dependencies.yml @@ -0,0 +1,6 @@ +projects: + - name: my_dbt_project + +packages: + - package: dbt-labs/dbt-utils + version: 1.0.0 \ No newline at end of file diff --git a/tests/1.7/valid/packages.yml b/tests/1.7/valid/packages.yml new file mode 100644 index 0000000..5729aae --- /dev/null +++ b/tests/1.7/valid/packages.yml @@ -0,0 +1,8 @@ +packages: + - package: dbt-labs/dbt-utils + version: 1.0.0 + + - git: "https://github.com/dbt-labs/dbt-utils.git" + revision: 1.0.0 + + - local: /opt/dbt/redshift \ No newline at end of file diff --git a/tests/1.7/valid/selectors.yml b/tests/1.7/valid/selectors.yml new file mode 100644 index 0000000..0782a30 --- /dev/null +++ b/tests/1.7/valid/selectors.yml @@ -0,0 +1,24 @@ +selectors: + - name: full_yml + definition: + method: tag + value: nightly + exclude: + - "@tag:daily" + + - name: single_cli + definition: + '+my_model' + + - name: key_value_example + definition: + tag: blue_light_special + + - name: full_yml_union_exclude + definition: + union: + - method: tag + value: nightly + - exclude: + - method: tag + value: daily \ No newline at end of file diff --git a/tests/validate_plusless_properties.py b/tests/validate_plusless_properties.py index 84b2797..8bd946a 100644 --- a/tests/validate_plusless_properties.py +++ b/tests/validate_plusless_properties.py @@ -4,7 +4,8 @@ PROJECT_SCHEMA_FILES = [ "./schemas/dbt_project.json", "./schemas/1.5/dbt_project-1.5.json", - "./schemas/1.6/dbt_project-1.6.json" + "./schemas/1.6/dbt_project-1.6.json", + "./schemas/1.7/dbt_project-1.7.json" ] def check_equivalency(key, node_type, node_properties):