From 9298dcfd469a4f11268428e915d9a6ae9f96da69 Mon Sep 17 00:00:00 2001 From: Dave Connors Date: Wed, 21 Jun 2023 09:05:51 -0500 Subject: [PATCH 01/14] version all the files, update CI tests and vscode settings --- .github/workflows/ci.yml | 46 +- .vscode/settings.json | 37 +- schemas/dbt_project-1.5.json | 807 +++++++++++++++++ schemas/dbt_project-1.6.json | 807 +++++++++++++++++ schemas/dbt_yml_files-1.5.json | 1046 +++++++++++++++++++++++ schemas/dbt_yml_files-1.6.json | 1046 +++++++++++++++++++++++ schemas/packages-1.5.json | 84 ++ schemas/packages-1.6.json | 84 ++ schemas/selectors-1.5.json | 153 ++++ schemas/selectors-1.6.json | 153 ++++ tests/{ => 1.5}/invalid/dbt_project.yml | 0 tests/{ => 1.5}/invalid/packages.yml | 0 tests/{ => 1.5}/invalid/schema.yml | 0 tests/{ => 1.5}/invalid/selectors.yml | 0 tests/{ => 1.5}/valid/dbt_project.yml | 0 tests/{ => 1.5}/valid/packages.yml | 0 tests/{ => 1.5}/valid/schema.yml | 0 tests/{ => 1.5}/valid/selectors.yml | 0 tests/1.6/invalid/dbt_project.yml | 49 ++ tests/1.6/invalid/packages.yml | 8 + tests/1.6/invalid/schema.yml | 62 ++ tests/1.6/invalid/selectors.yml | 8 + tests/1.6/valid/dbt_project.yml | 84 ++ tests/1.6/valid/packages.yml | 8 + tests/1.6/valid/schema.yml | 116 +++ tests/1.6/valid/selectors.yml | 24 + tests/validate_plusless_properties.py | 19 +- 27 files changed, 4612 insertions(+), 29 deletions(-) create mode 100644 schemas/dbt_project-1.5.json create mode 100644 schemas/dbt_project-1.6.json create mode 100644 schemas/dbt_yml_files-1.5.json create mode 100644 schemas/dbt_yml_files-1.6.json create mode 100644 schemas/packages-1.5.json create mode 100644 schemas/packages-1.6.json create mode 100644 schemas/selectors-1.5.json create mode 100644 schemas/selectors-1.6.json rename tests/{ => 1.5}/invalid/dbt_project.yml (100%) rename tests/{ => 1.5}/invalid/packages.yml (100%) rename tests/{ => 1.5}/invalid/schema.yml (100%) rename tests/{ => 1.5}/invalid/selectors.yml (100%) rename tests/{ => 1.5}/valid/dbt_project.yml (100%) rename tests/{ => 1.5}/valid/packages.yml (100%) rename tests/{ => 1.5}/valid/schema.yml (100%) rename tests/{ => 1.5}/valid/selectors.yml (100%) create mode 100644 tests/1.6/invalid/dbt_project.yml create mode 100644 tests/1.6/invalid/packages.yml create mode 100644 tests/1.6/invalid/schema.yml create mode 100644 tests/1.6/invalid/selectors.yml create mode 100644 tests/1.6/valid/dbt_project.yml create mode 100644 tests/1.6/valid/packages.yml create mode 100644 tests/1.6/valid/schema.yml create mode 100644 tests/1.6/valid/selectors.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bc1c21c..fae40a8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,10 +1,9 @@ name: CI -on: +on: - pull_request - workflow_dispatch - jobs: validate-json-schemas: runs-on: ubuntu-latest @@ -26,22 +25,39 @@ jobs: node-version: 16 - name: install avj run: npm install --no-save ajv-cli@5.0.0 - - name: Validate dbt_project.yml sample files + - name: Validate dbt_project.yml sample files for dbt version 1.5 + run: | + npx ajv-cli test -s schemas/dbt_project-1.5.json -d tests/1.5/valid/dbt_project.yml --valid + npx ajv-cli test -s schemas/dbt_project-1.5.json -d tests/1.5/invalid/dbt_project.yml --invalid + - name: Validate resource yml sample files for dbt version 1.5 + run: | + npx ajv-cli test -s schemas/dbt_yml_files-1.5.json -d tests/1.5/valid/schema.yml --valid + npx ajv-cli test -s schemas/dbt_yml_files-1.5.json -d tests/1.5/invalid/schema.yml --invalid + - name: Validate packages.yml sample files for dbt version 1.5 + run: | + npx ajv-cli test -s schemas/packages-1.5.json -d tests/1.5/valid/packages.yml --valid + npx ajv-cli test -s schemas/packages-1.5.json -d tests/1.5/invalid/packages.yml --invalid + - name: Validate selectors.yml sample files for dbt version 1.5 + run: | + npx ajv-cli test -s schemas/selectors-1.5.json -d tests/1.5/valid/selectors.yml --valid + npx ajv-cli test -s schemas/selectors-1.5.json -d tests/1.5/invalid/selectors.yml --invalid + + - name: Validate dbt_project.yml sample files for dbt version 1.6 run: | - npx ajv-cli test -s schemas/dbt_project.json -d tests/valid/dbt_project.yml --valid - npx ajv-cli test -s schemas/dbt_project.json -d tests/invalid/dbt_project.yml --invalid - - name: Validate resource yml sample files + npx ajv-cli test -s schemas/dbt_project-1.6.json -d tests/1.6/valid/dbt_project.yml --valid + npx ajv-cli test -s schemas/dbt_project-1.6.json -d tests/1.6/invalid/dbt_project.yml --invalid + - name: Validate resource yml sample files for dbt version 1.6 run: | - npx ajv-cli test -s schemas/dbt_yml_files.json -d tests/valid/schema.yml --valid - npx ajv-cli test -s schemas/dbt_yml_files.json -d tests/invalid/schema.yml --invalid - - name: Validate packages.yml sample files + npx ajv-cli test -s schemas/dbt_yml_files-1.6.json -d tests/1.6/valid/schema.yml --valid + npx ajv-cli test -s schemas/dbt_yml_files-1.6.json -d tests/1.6/invalid/schema.yml --invalid + - name: Validate packages.yml sample files for dbt version 1.6 run: | - npx ajv-cli test -s schemas/packages.json -d tests/valid/packages.yml --valid - npx ajv-cli test -s schemas/packages.json -d tests/invalid/packages.yml --invalid - - name: Validate selectors.yml sample files + npx ajv-cli test -s schemas/packages-1.6.json -d tests/1.6/valid/packages.yml --valid + npx ajv-cli test -s schemas/packages-1.6.json -d tests/1.6/invalid/packages.yml --invalid + - name: Validate selectors.yml sample files for dbt version 1.6 run: | - npx ajv-cli test -s schemas/selectors.json -d tests/valid/selectors.yml --valid - npx ajv-cli test -s schemas/selectors.json -d tests/invalid/selectors.yml --invalid + npx ajv-cli test -s schemas/selectors-1.6.json -d tests/1.6/valid/selectors.yml --valid + npx ajv-cli test -s schemas/selectors-1.6.json -d tests/1.6/invalid/selectors.yml --invalid validate_plusless_properties: runs-on: ubuntu-latest @@ -49,7 +65,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 with: - python-version: '3.x' + python-version: "3.x" - name: install avj run: | python -m pip install --upgrade pip diff --git a/.vscode/settings.json b/.vscode/settings.json index e34afb5..5ab9a40 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,7 +1,7 @@ { "yaml.schemas": { - "./schemas/dbt_yml_files.json": [ - "/*.yml", + "./schemas/dbt_yml_files-1.5.json": [ + "/tests/1.5/**/*.yml", "!profiles.yml", "!dbt_project.yml", "!packages.yml", @@ -9,15 +9,36 @@ "!profile_template.yml", "!/.github/**/*.yml" ], - "./schemas/dbt_project.json": [ - "dbt_project.yml" + "./schemas/dbt_project-1.5.json": [ + "/tests/1.5/**/dbt_project.yml" ], - "./schemas/selectors.json": [ - "selectors.yml" + "./schemas/selectors-1.5.json": [ + "/tests/1.5/**/selectors.yml" ], - "./schemas/packages.json": [ - "packages.yml" + "./schemas/packages-1.5.json": [ + "/tests/1.5/**/packages.yml" + + ], + "./schemas/dbt_yml_files-1.6.json": [ + "/tests/1.6/**/*.yml", + "!profiles.yml", + "!dbt_project.yml", + "!packages.yml", + "!selectors.yml", + "!profile_template.yml", + "!/.github/**/*.yml" + ], + "./schemas/dbt_project-1.6.json": [ + "/tests/1.6/**/dbt_project.yml" + ], + "./schemas/selectors-1.6.json": [ + "/tests/1.6/**/selectors.yml" + ], + "./schemas/packages-1.6.json": [ + "/tests/1.6/**/packages.yml" + ] + }, "sortJSON.orderOverride": [ "version", diff --git a/schemas/dbt_project-1.5.json b/schemas/dbt_project-1.5.json new file mode 100644 index 0000000..e848926 --- /dev/null +++ b/schemas/dbt_project-1.5.json @@ -0,0 +1,807 @@ +{ + "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 + }, + "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" + }, + "metrics": { + "$ref": "#/$defs/metric_configs" + }, + "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" + } + }, + "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 + }, + "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 + }, + "metric_configs": { + "title": "Metric configs", + "type": "object", + "description": "Configurations set in the dbt_project.yml file will apply to all metrics that don't have a more specific configuration set.", + "properties": { + "+enabled": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "+treat_null_values_as_zero": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "enabled": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "treat_null_values_as_zero": { + "$ref": "#/$defs/boolean_or_jinja_string" + } + }, + "additionalProperties": { + "oneOf" : [ + { + "$ref": "#/$defs/metric_configs" + }, + { + "$ref": "#/$defs/empty_directory" + } + ] + } + }, + "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": { + "+bind": { + "$ref": "#/$defs/boolean_or_jinja_string", + "default": false + }, + "+contract": { + "$ref": "#/$defs/contract" + }, + "+database": { + "$ref": "#/$defs/database" + }, + "+docs": { + "$ref": "#/$defs/docs_config" + }, + "+enabled": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "+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/label_configs" + }, + "+materialized": { + "$ref": "#/$defs/materialized" + }, + "+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" + }, + "+tags": { + "$ref": "#/$defs/string_or_array_of_strings" + }, + "+transient": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "bind": { + "$ref": "#/$defs/boolean_or_jinja_string", + "default": false + }, + "contract": { + "$ref": "#/$defs/contract" + }, + "database": { + "$ref": "#/$defs/database" + }, + "docs": { + "$ref": "#/$defs/docs_config" + }, + "enabled": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "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/label_configs" + }, + "materialized": { + "$ref": "#/$defs/materialized" + }, + "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" + }, + "tags": { + "$ref": "#/$defs/string_or_array_of_strings" + }, + "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" + }, + "+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" + }, + "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" + }, + "+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" + }, + "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" + }, + "+tags": { + "$ref": "#/$defs/string_or_array_of_strings" + }, + "enabled": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "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" + }, + "+limit": { + "$ref": "#/$defs/limit" + }, + "+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" + }, + "limit": { + "$ref": "#/$defs/limit" + }, + "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" + }, + "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." + }, + "materialized": { + "type": "string" + }, + "on_schema_change": { + "type": "string", + "enum": [ + "append_new_columns", + "fail", + "ignore", + "sync_all_columns" + ] + }, + "schema": { + "type": "string" + }, + "sql_header": { + "type": "string" + }, + "column_types": { + "type": "object", + "patternProperties": { + "": { + "type": "string" + } + } + }, + "alias": { + "type": "string" + }, + "grants": { + "type": "object" + }, + "strategy": { + "type": "string" + }, + "target_database": { + "type": "string" + }, + "target_schema": { + "type": "string" + }, + "updated_at": { + "type": "string" + }, + "error_if": { + "type": "string" + }, + "fail_calc": { + "type": "string" + }, + "limit": { + "type": "number" + }, + "severity": { + "type": "string", + "enum": [ + "warn", + "error" + ] + }, + "warn_if": { + "type": "string" + } + } +} \ No newline at end of file diff --git a/schemas/dbt_project-1.6.json b/schemas/dbt_project-1.6.json new file mode 100644 index 0000000..e848926 --- /dev/null +++ b/schemas/dbt_project-1.6.json @@ -0,0 +1,807 @@ +{ + "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 + }, + "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" + }, + "metrics": { + "$ref": "#/$defs/metric_configs" + }, + "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" + } + }, + "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 + }, + "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 + }, + "metric_configs": { + "title": "Metric configs", + "type": "object", + "description": "Configurations set in the dbt_project.yml file will apply to all metrics that don't have a more specific configuration set.", + "properties": { + "+enabled": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "+treat_null_values_as_zero": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "enabled": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "treat_null_values_as_zero": { + "$ref": "#/$defs/boolean_or_jinja_string" + } + }, + "additionalProperties": { + "oneOf" : [ + { + "$ref": "#/$defs/metric_configs" + }, + { + "$ref": "#/$defs/empty_directory" + } + ] + } + }, + "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": { + "+bind": { + "$ref": "#/$defs/boolean_or_jinja_string", + "default": false + }, + "+contract": { + "$ref": "#/$defs/contract" + }, + "+database": { + "$ref": "#/$defs/database" + }, + "+docs": { + "$ref": "#/$defs/docs_config" + }, + "+enabled": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "+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/label_configs" + }, + "+materialized": { + "$ref": "#/$defs/materialized" + }, + "+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" + }, + "+tags": { + "$ref": "#/$defs/string_or_array_of_strings" + }, + "+transient": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "bind": { + "$ref": "#/$defs/boolean_or_jinja_string", + "default": false + }, + "contract": { + "$ref": "#/$defs/contract" + }, + "database": { + "$ref": "#/$defs/database" + }, + "docs": { + "$ref": "#/$defs/docs_config" + }, + "enabled": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "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/label_configs" + }, + "materialized": { + "$ref": "#/$defs/materialized" + }, + "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" + }, + "tags": { + "$ref": "#/$defs/string_or_array_of_strings" + }, + "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" + }, + "+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" + }, + "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" + }, + "+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" + }, + "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" + }, + "+tags": { + "$ref": "#/$defs/string_or_array_of_strings" + }, + "enabled": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "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" + }, + "+limit": { + "$ref": "#/$defs/limit" + }, + "+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" + }, + "limit": { + "$ref": "#/$defs/limit" + }, + "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" + }, + "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." + }, + "materialized": { + "type": "string" + }, + "on_schema_change": { + "type": "string", + "enum": [ + "append_new_columns", + "fail", + "ignore", + "sync_all_columns" + ] + }, + "schema": { + "type": "string" + }, + "sql_header": { + "type": "string" + }, + "column_types": { + "type": "object", + "patternProperties": { + "": { + "type": "string" + } + } + }, + "alias": { + "type": "string" + }, + "grants": { + "type": "object" + }, + "strategy": { + "type": "string" + }, + "target_database": { + "type": "string" + }, + "target_schema": { + "type": "string" + }, + "updated_at": { + "type": "string" + }, + "error_if": { + "type": "string" + }, + "fail_calc": { + "type": "string" + }, + "limit": { + "type": "number" + }, + "severity": { + "type": "string", + "enum": [ + "warn", + "error" + ] + }, + "warn_if": { + "type": "string" + } + } +} \ No newline at end of file diff --git a/schemas/dbt_yml_files-1.5.json b/schemas/dbt_yml_files-1.5.json new file mode 100644 index 0000000..01e2739 --- /dev/null +++ b/schemas/dbt_yml_files-1.5.json @@ -0,0 +1,1046 @@ +{ + "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": { + "type": "object", + "required": ["show"], + "properties": { + "show": { + "type": "boolean" + } + } + } + } + } + }, + "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": false + } + }, + "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": { + "type": "object", + "properties": { + "show": { + "type": "boolean" + } + } + } + }, + "additionalProperties": false + } + }, + "metrics": { + "type": "array", + "items": { + "type": "object", + "required": ["name", "label", "calculation_method", "expression"], + "if": { + "properties": { + "calculation_method": { + "const": "derived" + } + } + }, + "then": { + "required": ["name", "label", "calculation_method", "expression"] + }, + "else": { + "required": [ + "name", + "model", + "label", + "calculation_method", + "expression" + ] + }, + "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" + } + } + }, + "calculation_method": { + "type": "string" + }, + "description": { + "type": "string" + }, + "dimensions": { + "$ref": "#/$defs/array_of_strings" + }, + "expression": { + "type": "string" + }, + "filters": { + "type": "array", + "items": { + "type": "object", + "required": ["field", "operator", "value"], + "properties": { + "field": { + "type": "string" + }, + "operator": { + "type": "string" + }, + "value": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "label": { + "type": "string" + }, + "meta": { + "type": "object" + }, + "model": { + "type": "string", + "default": "ref('')" + }, + "name": { + "type": "string" + }, + "time_grains": { + "$ref": "#/$defs/array_of_strings" + }, + "timestamp": { + "type": "string" + } + }, + "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": { + "type": "object", + "properties": { + "show": { + "type": "boolean" + } + } + }, + "group": { + "type": "string" + }, + "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" + }, + "quote_columns": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "schema": { + "type": "string" + } + } + }, + "description": { + "type": "string" + }, + "docs": { + "type": "object", + "properties": { + "show": { + "type": "boolean" + } + } + }, + "tests": { + "type": "array", + "items": { + "$ref": "#/$defs/tests" + } + } + }, + "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": { + "type": "object" + }, + "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": { + "type": "object", + "properties": { + "show": { + "type": "boolean" + } + } + }, + "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": { + "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 + }, + "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": { + "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 + }, + "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": "\\{\\{.*\\}\\}" + }, + "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": [ + { + "$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": { + "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" + } + } + } + } + } + ] + } + } +} diff --git a/schemas/dbt_yml_files-1.6.json b/schemas/dbt_yml_files-1.6.json new file mode 100644 index 0000000..01e2739 --- /dev/null +++ b/schemas/dbt_yml_files-1.6.json @@ -0,0 +1,1046 @@ +{ + "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": { + "type": "object", + "required": ["show"], + "properties": { + "show": { + "type": "boolean" + } + } + } + } + } + }, + "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": false + } + }, + "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": { + "type": "object", + "properties": { + "show": { + "type": "boolean" + } + } + } + }, + "additionalProperties": false + } + }, + "metrics": { + "type": "array", + "items": { + "type": "object", + "required": ["name", "label", "calculation_method", "expression"], + "if": { + "properties": { + "calculation_method": { + "const": "derived" + } + } + }, + "then": { + "required": ["name", "label", "calculation_method", "expression"] + }, + "else": { + "required": [ + "name", + "model", + "label", + "calculation_method", + "expression" + ] + }, + "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" + } + } + }, + "calculation_method": { + "type": "string" + }, + "description": { + "type": "string" + }, + "dimensions": { + "$ref": "#/$defs/array_of_strings" + }, + "expression": { + "type": "string" + }, + "filters": { + "type": "array", + "items": { + "type": "object", + "required": ["field", "operator", "value"], + "properties": { + "field": { + "type": "string" + }, + "operator": { + "type": "string" + }, + "value": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "label": { + "type": "string" + }, + "meta": { + "type": "object" + }, + "model": { + "type": "string", + "default": "ref('')" + }, + "name": { + "type": "string" + }, + "time_grains": { + "$ref": "#/$defs/array_of_strings" + }, + "timestamp": { + "type": "string" + } + }, + "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": { + "type": "object", + "properties": { + "show": { + "type": "boolean" + } + } + }, + "group": { + "type": "string" + }, + "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" + }, + "quote_columns": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "schema": { + "type": "string" + } + } + }, + "description": { + "type": "string" + }, + "docs": { + "type": "object", + "properties": { + "show": { + "type": "boolean" + } + } + }, + "tests": { + "type": "array", + "items": { + "$ref": "#/$defs/tests" + } + } + }, + "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": { + "type": "object" + }, + "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": { + "type": "object", + "properties": { + "show": { + "type": "boolean" + } + } + }, + "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": { + "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 + }, + "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": { + "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 + }, + "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": "\\{\\{.*\\}\\}" + }, + "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": [ + { + "$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": { + "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" + } + } + } + } + } + ] + } + } +} diff --git a/schemas/packages-1.5.json b/schemas/packages-1.5.json new file mode 100644 index 0000000..86cc8a9 --- /dev/null +++ b/schemas/packages-1.5.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/packages-1.6.json b/schemas/packages-1.6.json new file mode 100644 index 0000000..86cc8a9 --- /dev/null +++ b/schemas/packages-1.6.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/selectors-1.5.json b/schemas/selectors-1.5.json new file mode 100644 index 0000000..7c818d7 --- /dev/null +++ b/schemas/selectors-1.5.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/schemas/selectors-1.6.json b/schemas/selectors-1.6.json new file mode 100644 index 0000000..7c818d7 --- /dev/null +++ b/schemas/selectors-1.6.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/invalid/dbt_project.yml b/tests/1.5/invalid/dbt_project.yml similarity index 100% rename from tests/invalid/dbt_project.yml rename to tests/1.5/invalid/dbt_project.yml diff --git a/tests/invalid/packages.yml b/tests/1.5/invalid/packages.yml similarity index 100% rename from tests/invalid/packages.yml rename to tests/1.5/invalid/packages.yml diff --git a/tests/invalid/schema.yml b/tests/1.5/invalid/schema.yml similarity index 100% rename from tests/invalid/schema.yml rename to tests/1.5/invalid/schema.yml diff --git a/tests/invalid/selectors.yml b/tests/1.5/invalid/selectors.yml similarity index 100% rename from tests/invalid/selectors.yml rename to tests/1.5/invalid/selectors.yml diff --git a/tests/valid/dbt_project.yml b/tests/1.5/valid/dbt_project.yml similarity index 100% rename from tests/valid/dbt_project.yml rename to tests/1.5/valid/dbt_project.yml diff --git a/tests/valid/packages.yml b/tests/1.5/valid/packages.yml similarity index 100% rename from tests/valid/packages.yml rename to tests/1.5/valid/packages.yml diff --git a/tests/valid/schema.yml b/tests/1.5/valid/schema.yml similarity index 100% rename from tests/valid/schema.yml rename to tests/1.5/valid/schema.yml diff --git a/tests/valid/selectors.yml b/tests/1.5/valid/selectors.yml similarity index 100% rename from tests/valid/selectors.yml rename to tests/1.5/valid/selectors.yml diff --git a/tests/1.6/invalid/dbt_project.yml b/tests/1.6/invalid/dbt_project.yml new file mode 100644 index 0000000..95041ca --- /dev/null +++ b/tests/1.6/invalid/dbt_project.yml @@ -0,0 +1,49 @@ +# 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" + +seeds: + test: + +enabled: false + +metrics: + test: + invalid: true \ No newline at end of file diff --git a/tests/1.6/invalid/packages.yml b/tests/1.6/invalid/packages.yml new file mode 100644 index 0000000..54f02c4 --- /dev/null +++ b/tests/1.6/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.6/invalid/schema.yml b/tests/1.6/invalid/schema.yml new file mode 100644 index 0000000..f82c04a --- /dev/null +++ b/tests/1.6/invalid/schema.yml @@ -0,0 +1,62 @@ +# 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 + +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.6/invalid/selectors.yml b/tests/1.6/invalid/selectors.yml new file mode 100644 index 0000000..a21a0e2 --- /dev/null +++ b/tests/1.6/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.6/valid/dbt_project.yml b/tests/1.6/valid/dbt_project.yml new file mode 100644 index 0000000..d1f73c5 --- /dev/null +++ b/tests/1.6/valid/dbt_project.yml @@ -0,0 +1,84 @@ +# 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. +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: + contracted_models: + +contract: + enforced: true + + test_bq: + +labels: + key: val + jinja_key: "{{ target.name }}" + +seeds: + test: + +enabled: false + empty_subdirectory: + +tests: + test: + +enabled: true + empty_subdirectory: + +snapshots: + test: + +target_schema: schema + +target_database: database + +grants: + select: ['role'] + + empty_subdirectory: + +sources: + test: + +enabled: true + empty_subdirectory: + +metrics: + test: + +enabled: true + +treat_null_values_as_zero: true + empty_subdirectory: + +quoting: + database: true + schema: true + identifier: true diff --git a/tests/1.6/valid/packages.yml b/tests/1.6/valid/packages.yml new file mode 100644 index 0000000..5729aae --- /dev/null +++ b/tests/1.6/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.6/valid/schema.yml b/tests/1.6/valid/schema.yml new file mode 100644 index 0000000..277f4f3 --- /dev/null +++ b/tests/1.6/valid/schema.yml @@ -0,0 +1,116 @@ +# this file was generated with dbt init with dbt 1.2.1 + +models: + - name: my_first_dbt_model + description: "A starter dbt model" + columns: + - name: id + description: "The primary key for this table" + 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 + + - 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 + + +snapshots: + - name: snapshot_name + description: slowly changing dimension + columns: + - name: id + description: cool column, eh? + + +# model groups + +groups: + - name: analytics + owner: + name: dave + +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" + + - name: derived_metric + label: New Customers marked 'paying' + description: "The number of paid customers using the product" + + calculation_method: derived + expression: "{{ metric('new_customers') }} * 2" diff --git a/tests/1.6/valid/selectors.yml b/tests/1.6/valid/selectors.yml new file mode 100644 index 0000000..0782a30 --- /dev/null +++ b/tests/1.6/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 e2fdaeb..09c4915 100644 --- a/tests/validate_plusless_properties.py +++ b/tests/validate_plusless_properties.py @@ -1,6 +1,12 @@ import json from jsondiff import diff +PROJECT_SCHEMA_FILES = [ + "./schemas/dbt_project.json", + "./schemas/dbt_project-1.5.json", + "./schemas/dbt_project-1.6.json" +] + def check_equivalency(key, node_type, node_properties): if not key.startswith("+"): counterpart_key = "+" + key @@ -17,11 +23,12 @@ def check_equivalency(key, node_type, node_properties): raise Exception(f"{key} and {counterpart_key} both exist in {node_type}, but are different: {difference}") node_types = ['metric_configs', 'model_configs', 'seed_configs', 'snapshot_configs', 'source_configs', 'test_configs'] -with open("./schemas/dbt_project.json", "r") as f: - data = json.load(f) - for node_type in node_types: - node_properties = data["$defs"][node_type]["properties"] - for key in node_properties.keys(): - check_equivalency(key, node_type, node_properties) +for filepath in PROJECT_SCHEMA_FILES: + with open("./schemas/dbt_project.json", "r") as f: + data = json.load(f) + for node_type in node_types: + node_properties = data["$defs"][node_type]["properties"] + for key in node_properties.keys(): + check_equivalency(key, node_type, node_properties) From bc98e413aeb6428f1be7ea6f423115e509d75634 Mon Sep 17 00:00:00 2001 From: Dave Connors Date: Wed, 21 Jun 2023 09:07:25 -0500 Subject: [PATCH 02/14] smol python miss --- tests/validate_plusless_properties.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/validate_plusless_properties.py b/tests/validate_plusless_properties.py index 09c4915..cd20f8f 100644 --- a/tests/validate_plusless_properties.py +++ b/tests/validate_plusless_properties.py @@ -24,7 +24,7 @@ def check_equivalency(key, node_type, node_properties): node_types = ['metric_configs', 'model_configs', 'seed_configs', 'snapshot_configs', 'source_configs', 'test_configs'] for filepath in PROJECT_SCHEMA_FILES: - with open("./schemas/dbt_project.json", "r") as f: + with open(filepath, "r") as f: data = json.load(f) for node_type in node_types: node_properties = data["$defs"][node_type]["properties"] From 2e3f2e44e547efc6c23345614269f7858f8a2ccc Mon Sep 17 00:00:00 2001 From: Dave Connors Date: Wed, 21 Jun 2023 09:13:08 -0500 Subject: [PATCH 03/14] cleanup from merge conflict --- schemas/dbt_project-1.5.json | 1468 ++++++++++++++++--------------- schemas/dbt_project-1.6.json | 1468 ++++++++++++++++--------------- tests/1.5/valid/dbt_project.yml | 30 +- 3 files changed, 1497 insertions(+), 1469 deletions(-) diff --git a/schemas/dbt_project-1.5.json b/schemas/dbt_project-1.5.json index e848926..a624428 100644 --- a/schemas/dbt_project-1.5.json +++ b/schemas/dbt_project-1.5.json @@ -1,807 +1,817 @@ { - "title": "dbt_project", - "type": "object", - "required": [ - "name" - ], - "$schema": "http://json-schema.org/draft-07/schema#", - "properties": { - "version": { - "type": "string" - }, - "name": { + "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 + }, + "dispatch": { + "type": "array", + "items": { + "type": "object", + "required": ["macro_namespace", "search_order"], + "properties": { + "macro_namespace": { "type": "string" - }, - "analysis-paths": { + }, + "search_order": { "$ref": "#/$defs/array_of_strings" + } }, - "asset-paths": { - "$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" + }, + "metrics": { + "$ref": "#/$defs/metric_configs" + }, + "model-paths": { + "$ref": "#/$defs/array_of_strings" + }, + "models": { + "$ref": "#/$defs/model_configs" + }, + "on-run-end": { + "anyOf": [ + { + "$ref": "#/$defs/array_of_strings" }, - "clean-targets": { - "$ref": "#/$defs/array_of_strings" + { + "type": "string" + } + ] + }, + "on-run-start": { + "anyOf": [ + { + "$ref": "#/$defs/array_of_strings" }, - "config-version": { - "type": "number", - "default": 2 - }, - "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 + { + "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" }, - "docs-paths": { - "$ref": "#/$defs/array_of_strings" - }, - "log-path": { - "type": "string" + "identifier": { + "$ref": "#/$defs/boolean_or_jinja_string" }, - "macro-paths": { - "$ref": "#/$defs/array_of_strings" + "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" + } + }, + "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" }, - "metrics": { + { + "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 + }, + "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 + }, + "metric_configs": { + "title": "Metric configs", + "type": "object", + "description": "Configurations set in the dbt_project.yml file will apply to all metrics that don't have a more specific configuration set.", + "properties": { + "+enabled": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "+treat_null_values_as_zero": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "enabled": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "treat_null_values_as_zero": { + "$ref": "#/$defs/boolean_or_jinja_string" + } + }, + "additionalProperties": { + "oneOf": [ + { "$ref": "#/$defs/metric_configs" + }, + { + "$ref": "#/$defs/empty_directory" + } + ] + } + }, + "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": { + "+bind": { + "$ref": "#/$defs/boolean_or_jinja_string", + "default": false }, - "model-paths": { - "$ref": "#/$defs/array_of_strings" + "+contract": { + "$ref": "#/$defs/contract" }, - "models": { - "$ref": "#/$defs/model_configs" + "+database": { + "$ref": "#/$defs/database" }, - "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" + "+docs": { + "$ref": "#/$defs/docs_config" }, - "profile": { - "type": "string" + "+enabled": { + "$ref": "#/$defs/boolean_or_jinja_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" - } - } + "+file_format": { + "$ref": "#/$defs/file_format" }, - "require-dbt-version": { - "$ref": "#/$defs/string_or_array_of_strings" + "+grant_access_to": { + "$ref": "#/$defs/grant_access_to" }, - "seed-paths": { - "$ref": "#/$defs/array_of_strings" + "+hours_to_expiration": { + "$ref": "#/$defs/hours_to_expiration" }, - "seeds": { - "$ref": "#/$defs/seed_configs" + "+incremental_strategy": { + "$ref": "#/$defs/incremental_strategy" }, - "snapshot-paths": { - "$ref": "#/$defs/array_of_strings" + "+kms_key_name": { + "$ref": "#/$defs/kms_key_name" }, - "snapshots": { - "$ref": "#/$defs/snapshot_configs" + "+labels": { + "$ref": "#/$defs/label_configs" }, - "sources": { - "$ref": "#/$defs/source_configs" + "+location": { + "$ref": "#/$defs/location" }, - "target-path": { - "type": "string" + "+materialized": { + "$ref": "#/$defs/materialized" }, - "test-paths": { - "$ref": "#/$defs/array_of_strings" + "+on_schema_change": { + "$ref": "#/$defs/on_schema_change" }, - "tests": { - "$ref": "#/$defs/test_configs" + "+persist_docs": { + "$ref": "#/$defs/persist_docs_config" }, - "vars": { - "type": "object" - } - }, - "additionalProperties": false, - "$defs": { - "array_of_strings": { - "type": "array", - "items": { - "type": "string" - } + "+post-hook": { + "$ref": "#/$defs/array_of_strings" }, - "contract": { - "type": "object", - "required": [ - "enforced" - ], - "properties": { - "enforced": { - "$ref": "#/$defs/boolean_or_jinja_string", - "default": "true" - } - } + "+pre-hook": { + "$ref": "#/$defs/array_of_strings" }, - "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 - }, - "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 - }, - "metric_configs": { - "title": "Metric configs", - "type": "object", - "description": "Configurations set in the dbt_project.yml file will apply to all metrics that don't have a more specific configuration set.", - "properties": { - "+enabled": { - "$ref": "#/$defs/boolean_or_jinja_string" - }, - "+treat_null_values_as_zero": { - "$ref": "#/$defs/boolean_or_jinja_string" - }, - "enabled": { - "$ref": "#/$defs/boolean_or_jinja_string" - }, - "treat_null_values_as_zero": { - "$ref": "#/$defs/boolean_or_jinja_string" - } - }, - "additionalProperties": { - "oneOf" : [ - { - "$ref": "#/$defs/metric_configs" - }, - { - "$ref": "#/$defs/empty_directory" - } - ] - } + "+schema": { + "$ref": "#/$defs/schema" }, - "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": { - "+bind": { - "$ref": "#/$defs/boolean_or_jinja_string", - "default": false - }, - "+contract": { - "$ref": "#/$defs/contract" - }, - "+database": { - "$ref": "#/$defs/database" - }, - "+docs": { - "$ref": "#/$defs/docs_config" - }, - "+enabled": { - "$ref": "#/$defs/boolean_or_jinja_string" - }, - "+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/label_configs" - }, - "+materialized": { - "$ref": "#/$defs/materialized" - }, - "+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" - }, - "+tags": { - "$ref": "#/$defs/string_or_array_of_strings" - }, - "+transient": { - "$ref": "#/$defs/boolean_or_jinja_string" - }, - "bind": { - "$ref": "#/$defs/boolean_or_jinja_string", - "default": false - }, - "contract": { - "$ref": "#/$defs/contract" - }, - "database": { - "$ref": "#/$defs/database" - }, - "docs": { - "$ref": "#/$defs/docs_config" - }, - "enabled": { - "$ref": "#/$defs/boolean_or_jinja_string" - }, - "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/label_configs" - }, - "materialized": { - "$ref": "#/$defs/materialized" - }, - "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" - }, - "tags": { - "$ref": "#/$defs/string_or_array_of_strings" - }, - "transient": { - "$ref": "#/$defs/boolean_or_jinja_string" - } - }, - "additionalProperties": { - "oneOf": [ - { - "$ref": "#/$defs/model_configs" - }, - { - "$ref": "#/$defs/empty_directory" - } - ] - } + "+sql_header": { + "$ref": "#/$defs/sql_header" }, - "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" - }, - "+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" - }, - "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" - } - ] - } + "+tags": { + "$ref": "#/$defs/string_or_array_of_strings" }, - "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" - }, - "+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" - }, - "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" - } - ] - } + "+transient": { + "$ref": "#/$defs/boolean_or_jinja_string" }, - "source_configs": { - "title": "Source configs", - "type": "object", - "properties": { - "+enabled": { - "$ref": "#/$defs/boolean_or_jinja_string" - }, - "+tags": { - "$ref": "#/$defs/string_or_array_of_strings" - }, - "enabled": { - "$ref": "#/$defs/boolean_or_jinja_string" - }, - "tags": { - "$ref": "#/$defs/string_or_array_of_strings" - } - }, - "additionalProperties": { - "oneOf": [ - { - "$ref": "#/$defs/source_configs" - }, - { - "$ref": "#/$defs/empty_directory" - } - ] - } + "bind": { + "$ref": "#/$defs/boolean_or_jinja_string", + "default": false }, - "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" - }, - "+limit": { - "$ref": "#/$defs/limit" - }, - "+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" - }, - "limit": { - "$ref": "#/$defs/limit" - }, - "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" - } - ] - } + "contract": { + "$ref": "#/$defs/contract" }, "database": { - "type": "string" + "$ref": "#/$defs/database" + }, + "docs": { + "$ref": "#/$defs/docs_config" + }, + "enabled": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "file_format": { + "$ref": "#/$defs/file_format" }, "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" + }, + "location": { + "$ref": "#/$defs/location" }, "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" + }, + "post-hook": { + "$ref": "#/$defs/array_of_strings" + }, + "pre-hook": { + "$ref": "#/$defs/array_of_strings" }, "schema": { - "type": "string" + "$ref": "#/$defs/schema" }, "sql_header": { - "type": "string" + "$ref": "#/$defs/sql_header" + }, + "tags": { + "$ref": "#/$defs/string_or_array_of_strings" + }, + "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" + }, + "+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" + }, + "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": { - "type": "object", - "patternProperties": { - "": { - "type": "string" - } - } + "$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" + }, + "+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": { - "type": "string" + "$ref": "#/$defs/alias" + }, + "check_cols": { + "$ref": "#/$defs/string_or_array_of_strings" + }, + "enabled": { + "$ref": "#/$defs/boolean_or_jinja_string" }, "grants": { - "type": "object" + "$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" + "$ref": "#/$defs/strategy" + }, + "tags": { + "$ref": "#/$defs/string_or_array_of_strings" }, "target_database": { - "type": "string" + "$ref": "#/$defs/target_database" }, "target_schema": { - "type": "string" + "$ref": "#/$defs/target_schema" + }, + "transient": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "unique_key": { + "$ref": "#/$defs/string_or_array_of_strings" }, "updated_at": { - "type": "string" + "$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" + }, + "+tags": { + "$ref": "#/$defs/string_or_array_of_strings" + }, + "enabled": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "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" + }, + "+limit": { + "$ref": "#/$defs/limit" + }, + "+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": { - "type": "string" + "$ref": "#/$defs/error_if" }, "fail_calc": { - "type": "string" + "$ref": "#/$defs/fail_calc" }, "limit": { - "type": "number" + "$ref": "#/$defs/limit" }, "severity": { - "type": "string", - "enum": [ - "warn", - "error" - ] + "$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 + } + }, + "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" + }, + "on_schema_change": { + "type": "string", + "enum": ["append_new_columns", "fail", "ignore", "sync_all_columns"] + }, + "schema": { + "type": "string" + }, + "sql_header": { + "type": "string" + }, + "column_types": { + "type": "object", + "patternProperties": { + "": { + "type": "string" + } + } + }, + "alias": { + "type": "string" + }, + "grants": { + "type": "object" + }, + "strategy": { + "type": "string" + }, + "target_database": { + "type": "string" + }, + "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" } -} \ No newline at end of file + } +} diff --git a/schemas/dbt_project-1.6.json b/schemas/dbt_project-1.6.json index e848926..a624428 100644 --- a/schemas/dbt_project-1.6.json +++ b/schemas/dbt_project-1.6.json @@ -1,807 +1,817 @@ { - "title": "dbt_project", - "type": "object", - "required": [ - "name" - ], - "$schema": "http://json-schema.org/draft-07/schema#", - "properties": { - "version": { - "type": "string" - }, - "name": { + "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 + }, + "dispatch": { + "type": "array", + "items": { + "type": "object", + "required": ["macro_namespace", "search_order"], + "properties": { + "macro_namespace": { "type": "string" - }, - "analysis-paths": { + }, + "search_order": { "$ref": "#/$defs/array_of_strings" + } }, - "asset-paths": { - "$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" + }, + "metrics": { + "$ref": "#/$defs/metric_configs" + }, + "model-paths": { + "$ref": "#/$defs/array_of_strings" + }, + "models": { + "$ref": "#/$defs/model_configs" + }, + "on-run-end": { + "anyOf": [ + { + "$ref": "#/$defs/array_of_strings" }, - "clean-targets": { - "$ref": "#/$defs/array_of_strings" + { + "type": "string" + } + ] + }, + "on-run-start": { + "anyOf": [ + { + "$ref": "#/$defs/array_of_strings" }, - "config-version": { - "type": "number", - "default": 2 - }, - "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 + { + "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" }, - "docs-paths": { - "$ref": "#/$defs/array_of_strings" - }, - "log-path": { - "type": "string" + "identifier": { + "$ref": "#/$defs/boolean_or_jinja_string" }, - "macro-paths": { - "$ref": "#/$defs/array_of_strings" + "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" + } + }, + "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" }, - "metrics": { + { + "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 + }, + "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 + }, + "metric_configs": { + "title": "Metric configs", + "type": "object", + "description": "Configurations set in the dbt_project.yml file will apply to all metrics that don't have a more specific configuration set.", + "properties": { + "+enabled": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "+treat_null_values_as_zero": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "enabled": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "treat_null_values_as_zero": { + "$ref": "#/$defs/boolean_or_jinja_string" + } + }, + "additionalProperties": { + "oneOf": [ + { "$ref": "#/$defs/metric_configs" + }, + { + "$ref": "#/$defs/empty_directory" + } + ] + } + }, + "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": { + "+bind": { + "$ref": "#/$defs/boolean_or_jinja_string", + "default": false }, - "model-paths": { - "$ref": "#/$defs/array_of_strings" + "+contract": { + "$ref": "#/$defs/contract" }, - "models": { - "$ref": "#/$defs/model_configs" + "+database": { + "$ref": "#/$defs/database" }, - "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" + "+docs": { + "$ref": "#/$defs/docs_config" }, - "profile": { - "type": "string" + "+enabled": { + "$ref": "#/$defs/boolean_or_jinja_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" - } - } + "+file_format": { + "$ref": "#/$defs/file_format" }, - "require-dbt-version": { - "$ref": "#/$defs/string_or_array_of_strings" + "+grant_access_to": { + "$ref": "#/$defs/grant_access_to" }, - "seed-paths": { - "$ref": "#/$defs/array_of_strings" + "+hours_to_expiration": { + "$ref": "#/$defs/hours_to_expiration" }, - "seeds": { - "$ref": "#/$defs/seed_configs" + "+incremental_strategy": { + "$ref": "#/$defs/incremental_strategy" }, - "snapshot-paths": { - "$ref": "#/$defs/array_of_strings" + "+kms_key_name": { + "$ref": "#/$defs/kms_key_name" }, - "snapshots": { - "$ref": "#/$defs/snapshot_configs" + "+labels": { + "$ref": "#/$defs/label_configs" }, - "sources": { - "$ref": "#/$defs/source_configs" + "+location": { + "$ref": "#/$defs/location" }, - "target-path": { - "type": "string" + "+materialized": { + "$ref": "#/$defs/materialized" }, - "test-paths": { - "$ref": "#/$defs/array_of_strings" + "+on_schema_change": { + "$ref": "#/$defs/on_schema_change" }, - "tests": { - "$ref": "#/$defs/test_configs" + "+persist_docs": { + "$ref": "#/$defs/persist_docs_config" }, - "vars": { - "type": "object" - } - }, - "additionalProperties": false, - "$defs": { - "array_of_strings": { - "type": "array", - "items": { - "type": "string" - } + "+post-hook": { + "$ref": "#/$defs/array_of_strings" }, - "contract": { - "type": "object", - "required": [ - "enforced" - ], - "properties": { - "enforced": { - "$ref": "#/$defs/boolean_or_jinja_string", - "default": "true" - } - } + "+pre-hook": { + "$ref": "#/$defs/array_of_strings" }, - "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 - }, - "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 - }, - "metric_configs": { - "title": "Metric configs", - "type": "object", - "description": "Configurations set in the dbt_project.yml file will apply to all metrics that don't have a more specific configuration set.", - "properties": { - "+enabled": { - "$ref": "#/$defs/boolean_or_jinja_string" - }, - "+treat_null_values_as_zero": { - "$ref": "#/$defs/boolean_or_jinja_string" - }, - "enabled": { - "$ref": "#/$defs/boolean_or_jinja_string" - }, - "treat_null_values_as_zero": { - "$ref": "#/$defs/boolean_or_jinja_string" - } - }, - "additionalProperties": { - "oneOf" : [ - { - "$ref": "#/$defs/metric_configs" - }, - { - "$ref": "#/$defs/empty_directory" - } - ] - } + "+schema": { + "$ref": "#/$defs/schema" }, - "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": { - "+bind": { - "$ref": "#/$defs/boolean_or_jinja_string", - "default": false - }, - "+contract": { - "$ref": "#/$defs/contract" - }, - "+database": { - "$ref": "#/$defs/database" - }, - "+docs": { - "$ref": "#/$defs/docs_config" - }, - "+enabled": { - "$ref": "#/$defs/boolean_or_jinja_string" - }, - "+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/label_configs" - }, - "+materialized": { - "$ref": "#/$defs/materialized" - }, - "+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" - }, - "+tags": { - "$ref": "#/$defs/string_or_array_of_strings" - }, - "+transient": { - "$ref": "#/$defs/boolean_or_jinja_string" - }, - "bind": { - "$ref": "#/$defs/boolean_or_jinja_string", - "default": false - }, - "contract": { - "$ref": "#/$defs/contract" - }, - "database": { - "$ref": "#/$defs/database" - }, - "docs": { - "$ref": "#/$defs/docs_config" - }, - "enabled": { - "$ref": "#/$defs/boolean_or_jinja_string" - }, - "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/label_configs" - }, - "materialized": { - "$ref": "#/$defs/materialized" - }, - "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" - }, - "tags": { - "$ref": "#/$defs/string_or_array_of_strings" - }, - "transient": { - "$ref": "#/$defs/boolean_or_jinja_string" - } - }, - "additionalProperties": { - "oneOf": [ - { - "$ref": "#/$defs/model_configs" - }, - { - "$ref": "#/$defs/empty_directory" - } - ] - } + "+sql_header": { + "$ref": "#/$defs/sql_header" }, - "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" - }, - "+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" - }, - "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" - } - ] - } + "+tags": { + "$ref": "#/$defs/string_or_array_of_strings" }, - "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" - }, - "+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" - }, - "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" - } - ] - } + "+transient": { + "$ref": "#/$defs/boolean_or_jinja_string" }, - "source_configs": { - "title": "Source configs", - "type": "object", - "properties": { - "+enabled": { - "$ref": "#/$defs/boolean_or_jinja_string" - }, - "+tags": { - "$ref": "#/$defs/string_or_array_of_strings" - }, - "enabled": { - "$ref": "#/$defs/boolean_or_jinja_string" - }, - "tags": { - "$ref": "#/$defs/string_or_array_of_strings" - } - }, - "additionalProperties": { - "oneOf": [ - { - "$ref": "#/$defs/source_configs" - }, - { - "$ref": "#/$defs/empty_directory" - } - ] - } + "bind": { + "$ref": "#/$defs/boolean_or_jinja_string", + "default": false }, - "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" - }, - "+limit": { - "$ref": "#/$defs/limit" - }, - "+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" - }, - "limit": { - "$ref": "#/$defs/limit" - }, - "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" - } - ] - } + "contract": { + "$ref": "#/$defs/contract" }, "database": { - "type": "string" + "$ref": "#/$defs/database" + }, + "docs": { + "$ref": "#/$defs/docs_config" + }, + "enabled": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "file_format": { + "$ref": "#/$defs/file_format" }, "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" + }, + "location": { + "$ref": "#/$defs/location" }, "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" + }, + "post-hook": { + "$ref": "#/$defs/array_of_strings" + }, + "pre-hook": { + "$ref": "#/$defs/array_of_strings" }, "schema": { - "type": "string" + "$ref": "#/$defs/schema" }, "sql_header": { - "type": "string" + "$ref": "#/$defs/sql_header" + }, + "tags": { + "$ref": "#/$defs/string_or_array_of_strings" + }, + "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" + }, + "+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" + }, + "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": { - "type": "object", - "patternProperties": { - "": { - "type": "string" - } - } + "$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" + }, + "+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": { - "type": "string" + "$ref": "#/$defs/alias" + }, + "check_cols": { + "$ref": "#/$defs/string_or_array_of_strings" + }, + "enabled": { + "$ref": "#/$defs/boolean_or_jinja_string" }, "grants": { - "type": "object" + "$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" + "$ref": "#/$defs/strategy" + }, + "tags": { + "$ref": "#/$defs/string_or_array_of_strings" }, "target_database": { - "type": "string" + "$ref": "#/$defs/target_database" }, "target_schema": { - "type": "string" + "$ref": "#/$defs/target_schema" + }, + "transient": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "unique_key": { + "$ref": "#/$defs/string_or_array_of_strings" }, "updated_at": { - "type": "string" + "$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" + }, + "+tags": { + "$ref": "#/$defs/string_or_array_of_strings" + }, + "enabled": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "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" + }, + "+limit": { + "$ref": "#/$defs/limit" + }, + "+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": { - "type": "string" + "$ref": "#/$defs/error_if" }, "fail_calc": { - "type": "string" + "$ref": "#/$defs/fail_calc" }, "limit": { - "type": "number" + "$ref": "#/$defs/limit" }, "severity": { - "type": "string", - "enum": [ - "warn", - "error" - ] + "$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 + } + }, + "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" + }, + "on_schema_change": { + "type": "string", + "enum": ["append_new_columns", "fail", "ignore", "sync_all_columns"] + }, + "schema": { + "type": "string" + }, + "sql_header": { + "type": "string" + }, + "column_types": { + "type": "object", + "patternProperties": { + "": { + "type": "string" + } + } + }, + "alias": { + "type": "string" + }, + "grants": { + "type": "object" + }, + "strategy": { + "type": "string" + }, + "target_database": { + "type": "string" + }, + "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" } -} \ No newline at end of file + } +} diff --git a/tests/1.5/valid/dbt_project.yml b/tests/1.5/valid/dbt_project.yml index d1f73c5..3ce0963 100644 --- a/tests/1.5/valid/dbt_project.yml +++ b/tests/1.5/valid/dbt_project.yml @@ -3,10 +3,10 @@ # 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' +name: "test" # This setting configures which "profile" dbt uses for this project. -profile: 'test' +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 @@ -18,12 +18,11 @@ 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-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 @@ -42,7 +41,7 @@ models: contracted_models: +contract: enforced: true - + test_bq: +labels: key: val @@ -54,26 +53,35 @@ seeds: empty_subdirectory: tests: - test: + 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 + +target_database: database +grants: - select: ['role'] + select: ["role"] empty_subdirectory: sources: - test: + test: +enabled: true empty_subdirectory: metrics: - test: + test: +enabled: true +treat_null_values_as_zero: true empty_subdirectory: From 127560cabae3f04359868392d4065228ab507dba Mon Sep 17 00:00:00 2001 From: Dave Connors Date: Wed, 21 Jun 2023 09:16:00 -0500 Subject: [PATCH 04/14] more cleanup --- schemas/dbt_yml_files-1.5.json | 1823 +++++++++++++++-------------- schemas/dbt_yml_files-1.6.json | 1823 +++++++++++++++-------------- tests/1.5/invalid/dbt_project.yml | 20 +- tests/1.5/valid/schema.yml | 46 +- 4 files changed, 1884 insertions(+), 1828 deletions(-) diff --git a/schemas/dbt_yml_files-1.5.json b/schemas/dbt_yml_files-1.5.json index 01e2739..4bceb34 100644 --- a/schemas/dbt_yml_files-1.5.json +++ b/schemas/dbt_yml_files-1.5.json @@ -1,1046 +1,1071 @@ { - "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": { + "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": { - "tags": { - "$ref": "#/$defs/string_or_array_of_strings" + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "data_type": { + "type": "string" } }, "additionalProperties": false + } + }, + "config": { + "type": "object", + "properties": { + "tags": { + "$ref": "#/$defs/string_or_array_of_strings" + } }, - "description": { - "type": "string" - }, - "docs": { - "type": "object", - "required": ["show"], - "properties": { - "show": { - "type": "boolean" - } + "additionalProperties": false + }, + "description": { + "type": "string" + }, + "docs": { + "type": "object", + "required": ["show"], + "properties": { + "show": { + "type": "boolean" } } } } - }, - "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": { + } + }, + "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" - }, - "label": { - "type": "string", - "$comment": "Added in dbt Core v1.3" - }, - "type": { - "type": "string", - "enum": ["dashboard", "notebook", "analysis", "ml", "application"] - }, - "depends_on": { - "type": "array", - "items": { + } + }, + "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" } }, - "description": { - "type": "string" - }, - "maturity": { - "type": "string", - "enum": ["high", "medium", "low"] - }, - "meta": { - "type": "object" + "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" + } }, - "owner": { + "additionalProperties": false + } + }, + "additionalProperties": false + } + }, + "macros": { + "type": "array", + "items": { + "type": "object", + "required": ["name"], + "properties": { + "name": { + "type": "string" + }, + "arguments": { + "type": "array", + "items": { "type": "object", - "required": ["email"], + "required": ["name"], "properties": { "name": { "type": "string" }, - "email": { + "type": { + "type": "string" + }, + "description": { "type": "string" } }, "additionalProperties": false - }, - "tags": { - "$ref": "#/$defs/string_or_array_of_strings" - }, - "url": { - "type": "string" + } + }, + "description": { + "type": "string" + }, + "docs": { + "type": "object", + "properties": { + "show": { + "type": "boolean" + } } } - } - }, - "groups": { - "type": "array", - "items": { - "type": "object", - "required": ["name", "owner"], + }, + "additionalProperties": false + } + }, + "metrics": { + "type": "array", + "items": { + "type": "object", + "required": ["name", "label", "calculation_method", "expression"], + "if": { "properties": { - "name": { - "type": "string" - }, - "owner": { + "calculation_method": { + "const": "derived" + } + } + }, + "then": { + "required": ["name", "label", "calculation_method", "expression"] + }, + "else": { + "required": [ + "name", + "model", + "label", + "calculation_method", + "expression" + ] + }, + "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" + } + } + }, + "calculation_method": { + "type": "string" + }, + "description": { + "type": "string" + }, + "dimensions": { + "$ref": "#/$defs/array_of_strings" + }, + "expression": { + "type": "string" + }, + "filters": { + "type": "array", + "items": { "type": "object", - "minProperties": 1, + "required": ["field", "operator", "value"], "properties": { - "name": { + "field": { "type": "string" }, - "email": { + "operator": { + "type": "string" + }, + "value": { "type": "string" } }, "additionalProperties": false } }, - "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": { - "type": "object", - "properties": { - "show": { - "type": "boolean" - } + "label": { + "type": "string" + }, + "meta": { + "type": "object" + }, + "model": { + "type": "string", + "default": "ref('')" + }, + "name": { + "type": "string" + }, + "time_grains": { + "$ref": "#/$defs/array_of_strings" + }, + "timestamp": { + "type": "string" + }, + "window": { + "type": "object", + "properties": { + "count": { + "type": "integer" + }, + "period": { + "type": "string", + "enum": ["day", "week", "month", "year"] } } + } + }, + "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" + } }, - "additionalProperties": false - } - }, - "metrics": { - "type": "array", - "items": { - "type": "object", - "required": ["name", "label", "calculation_method", "expression"], - "if": { + "config": { + "$ref": "#/$defs/model_configs" + }, + "constraints": { + "$ref": "#/$defs/constraints" + }, + "description": { + "type": "string" + }, + "docs": { + "type": "object", "properties": { - "calculation_method": { - "const": "derived" + "show": { + "type": "boolean" } } }, - "then": { - "required": ["name", "label", "calculation_method", "expression"] + "group": { + "type": "string" }, - "else": { - "required": [ - "name", - "model", - "label", - "calculation_method", - "expression" - ] + "latest_version": { + "type": "number" }, - "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" - } - } - }, - "calculation_method": { - "type": "string" - }, - "description": { - "type": "string" - }, - "dimensions": { - "$ref": "#/$defs/array_of_strings" - }, - "expression": { - "type": "string" - }, - "filters": { - "type": "array", - "items": { - "type": "object", - "required": ["field", "operator", "value"], - "properties": { - "field": { - "type": "string" - }, - "operator": { - "type": "string" - }, - "value": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "label": { - "type": "string" - }, - "meta": { - "type": "object" - }, - "model": { - "type": "string", - "default": "ref('')" - }, - "name": { - "type": "string" - }, - "time_grains": { - "$ref": "#/$defs/array_of_strings" - }, - "timestamp": { - "type": "string" + "meta": { + "type": "object" + }, + "tests": { + "type": "array", + "items": { + "$ref": "#/$defs/tests" } }, - "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": { + "versions": { + "type": "array", + "items": { "type": "object", + "required": ["v"], "properties": { - "show": { - "type": "boolean" - } - } - }, - "group": { - "type": "string" - }, - "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" - } - ] - } + "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" + } }, - "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" + }, + "quote_columns": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "schema": { + "type": "string" } - }, - "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" - }, - "quote_columns": { - "$ref": "#/$defs/boolean_or_jinja_string" - }, - "schema": { - "type": "string" - } + } + }, + "description": { + "type": "string" + }, + "docs": { + "type": "object", + "properties": { + "show": { + "type": "boolean" } - }, - "description": { - "type": "string" - }, - "docs": { - "type": "object", - "properties": { - "show": { - "type": "boolean" - } + } + }, + "tests": { + "type": "array", + "items": { + "$ref": "#/$defs/tests" + } + } + }, + "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": { + "type": "object" + }, + "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" } - }, - "tests": { - "type": "array", - "items": { - "$ref": "#/$defs/tests" + } + }, + "description": { + "type": "string" + }, + "docs": { + "type": "object", + "properties": { + "show": { + "type": "boolean" } } }, - "additionalProperties": false - } - }, - "snapshots": { - "type": "array", - "items": { - "type": "object", - "required": ["name"], - "properties": { - "name": { - "type": "string" - }, - "columns": { - "type": "array", - "items": { - "$ref": "#/$defs/column_properties" + "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" } }, - "config": { + "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": { - "alias": { - "type": "string" - }, - "check_cols": { - "$ref": "#/$defs/string_or_array_of_strings" - }, - "enabled": { - "$ref": "#/$defs/boolean_or_jinja_string" - }, - "grants": { - "type": "object" - }, - "persist_docs": { - "$ref": "#/$defs/persist_docs_config" + "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." }, - "post-hook": { - "$ref": "#/$defs/array_of_strings" + "columns": { + "type": "array", + "items": { + "$ref": "#/$defs/column_properties" + } }, - "pre-hook": { - "$ref": "#/$defs/array_of_strings" + "description": { + "type": "string" }, - "quote_columns": { - "$ref": "#/$defs/boolean_or_jinja_string" + "external": { + "type": "object" }, - "strategy": { - "type": "string" + "freshness": { + "$ref": "#/$defs/freshness_definition" }, - "tags": { - "$ref": "#/$defs/string_or_array_of_strings" + "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)" }, - "target_database": { - "type": "string" + "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." }, - "target_schema": { - "type": "string" + "loader": { + "type": "string" }, - "unique_key": { - "$ref": "#/$defs/string_or_array_of_strings" + "meta": { + "type": "object" }, - "updated_at": { - "type": "string" - } - } - }, - "description": { - "type": "string" - }, - "docs": { - "type": "object", - "properties": { - "show": { - "type": "boolean" - } - } - }, - "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" + "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 }, - "identifier": { - "$ref": "#/$defs/boolean_or_jinja_string" + "tags": { + "$ref": "#/$defs/string_or_array_of_strings" }, - "schema": { - "$ref": "#/$defs/boolean_or_jinja_string" + "tests": { + "type": "array", + "items": { + "$ref": "#/$defs/tests" + } } }, "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" - } + } + }, + "tags": { + "$ref": "#/$defs/string_or_array_of_strings" + }, + "tests": { + "type": "array", + "items": { + "$ref": "#/$defs/tests" } } } } + } + }, + "additionalProperties": false, + "$defs": { + "array_of_strings": { + "type": "array", + "items": { + "type": "string" + } }, - "additionalProperties": false, - "$defs": { - "array_of_strings": { - "type": "array", - "items": { - "type": "string" + "boolean_or_jinja_string": { + "oneOf": [ + { + "$ref": "#/$defs/jinja_string" + }, + { + "type": "boolean" } - }, - "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" } - ], - "additionalProperties": false + }, + "quote": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "tests": { + "type": "array", + "items": { + "$ref": "#/$defs/tests" + } + }, + "tags": { + "$ref": "#/$defs/string_or_array_of_strings" + } }, - "column_properties": { + "additionalProperties": false + }, + "constraints": { + "type": "array", + "items": { "type": "object", - "required": ["name"], + "required": ["type"], "properties": { - "name": { - "type": "string" - }, - "constraints": { - "$ref": "#/$defs/constraints" + "columns": { + "$ref": "#/$defs/string_or_array_of_strings" }, - "data_type": { + "expression": { "type": "string" }, - "description": { + "name": { "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" - } + "type": { + "type": "string" }, - "quote": { + "warn_unenforced": { "$ref": "#/$defs/boolean_or_jinja_string" }, - "tests": { - "type": "array", - "items": { - "$ref": "#/$defs/tests" - } - }, - "tags": { - "$ref": "#/$defs/string_or_array_of_strings" + "warn_unsupported": { + "$ref": "#/$defs/boolean_or_jinja_string" } + } + } + }, + "freshness_definition": { + "default": { + "warn_after": { + "count": 1, + "period": "day" }, - "additionalProperties": false + "error_after": { + "count": 2, + "period": "day" + } }, - "constraints": { - "type": "array", - "items": { + "oneOf": [ + { "type": "object", - "required": ["type"], "properties": { - "columns": { - "$ref": "#/$defs/string_or_array_of_strings" - }, - "expression": { - "type": "string" + "error_after": { + "$ref": "#/$defs/freshness_rules" }, - "name": { + "filter": { "type": "string" }, - "type": { - "type": "string" - }, - "warn_unenforced": { - "$ref": "#/$defs/boolean_or_jinja_string" - }, - "warn_unsupported": { - "$ref": "#/$defs/boolean_or_jinja_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"] } }, - "freshness_definition": { - "default": { - "warn_after": { - "count": 1, - "period": "day" - }, - "error_after": { - "count": 2, - "period": "day" + "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": "\\{\\{.*\\}\\}" + }, + "model_configs": { + "type": "object", + "properties": { + "contract": { + "type": "object", + "properties": { + "enforced": { + "$ref": "#/$defs/boolean_or_jinja_string" + } } }, - "oneOf": [ - { + "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": { - "error_after": { - "$ref": "#/$defs/freshness_rules" - }, - "filter": { + "database": { "type": "string" }, - "warn_after": { - "$ref": "#/$defs/freshness_rules" + "project": { + "type": "string" } }, "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 - }, - "include_exclude": { - "type": "object", - "properties": { - "include": { - "$ref": "#/$defs/string_or_array_of_strings" + "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}$" + } }, - "exclude": { - "$ref": "#/$defs/string_or_array_of_strings" - } + "additionalProperties": false + }, + "location": { + "type": "string" + }, + "materialized": { + "type": "string" + }, + "sql_header": { + "type": "string" + } + } + }, + "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 } }, - "jinja_string": { - "type": "string", - "pattern": "\\{\\{.*\\}\\}" - }, - "model_configs": { - "type": "object", - "properties": { - "contract": { - "type": "object", - "properties": { - "enforced": { - "$ref": "#/$defs/boolean_or_jinja_string" - } + "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"] } - }, - "grant_access_to": { - "title": "Authorized views", - "type": "array", - "description": "Configuration, specific to BigQuery adapter, used to setup authorized views.", - "items": { + ] + }, + "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": ["database", "project"], + "required": ["to", "field"], "properties": { - "database": { + "name": { "type": "string" }, - "project": { + "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" } - }, - "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": [ - { - "$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": { - "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": { + { + "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": "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" - } + } + }, + { + "title": "Unique Test", + "type": "object", + "properties": { + "unique": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "config": { + "$ref": "#/$defs/test_configs" + }, + "where": { + "type": "string" } } } } - ] - } + } + ] } + } } diff --git a/schemas/dbt_yml_files-1.6.json b/schemas/dbt_yml_files-1.6.json index 01e2739..4bceb34 100644 --- a/schemas/dbt_yml_files-1.6.json +++ b/schemas/dbt_yml_files-1.6.json @@ -1,1046 +1,1071 @@ { - "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": { + "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": { - "tags": { - "$ref": "#/$defs/string_or_array_of_strings" + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "data_type": { + "type": "string" } }, "additionalProperties": false + } + }, + "config": { + "type": "object", + "properties": { + "tags": { + "$ref": "#/$defs/string_or_array_of_strings" + } }, - "description": { - "type": "string" - }, - "docs": { - "type": "object", - "required": ["show"], - "properties": { - "show": { - "type": "boolean" - } + "additionalProperties": false + }, + "description": { + "type": "string" + }, + "docs": { + "type": "object", + "required": ["show"], + "properties": { + "show": { + "type": "boolean" } } } } - }, - "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": { + } + }, + "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" - }, - "label": { - "type": "string", - "$comment": "Added in dbt Core v1.3" - }, - "type": { - "type": "string", - "enum": ["dashboard", "notebook", "analysis", "ml", "application"] - }, - "depends_on": { - "type": "array", - "items": { + } + }, + "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" } }, - "description": { - "type": "string" - }, - "maturity": { - "type": "string", - "enum": ["high", "medium", "low"] - }, - "meta": { - "type": "object" + "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" + } }, - "owner": { + "additionalProperties": false + } + }, + "additionalProperties": false + } + }, + "macros": { + "type": "array", + "items": { + "type": "object", + "required": ["name"], + "properties": { + "name": { + "type": "string" + }, + "arguments": { + "type": "array", + "items": { "type": "object", - "required": ["email"], + "required": ["name"], "properties": { "name": { "type": "string" }, - "email": { + "type": { + "type": "string" + }, + "description": { "type": "string" } }, "additionalProperties": false - }, - "tags": { - "$ref": "#/$defs/string_or_array_of_strings" - }, - "url": { - "type": "string" + } + }, + "description": { + "type": "string" + }, + "docs": { + "type": "object", + "properties": { + "show": { + "type": "boolean" + } } } - } - }, - "groups": { - "type": "array", - "items": { - "type": "object", - "required": ["name", "owner"], + }, + "additionalProperties": false + } + }, + "metrics": { + "type": "array", + "items": { + "type": "object", + "required": ["name", "label", "calculation_method", "expression"], + "if": { "properties": { - "name": { - "type": "string" - }, - "owner": { + "calculation_method": { + "const": "derived" + } + } + }, + "then": { + "required": ["name", "label", "calculation_method", "expression"] + }, + "else": { + "required": [ + "name", + "model", + "label", + "calculation_method", + "expression" + ] + }, + "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" + } + } + }, + "calculation_method": { + "type": "string" + }, + "description": { + "type": "string" + }, + "dimensions": { + "$ref": "#/$defs/array_of_strings" + }, + "expression": { + "type": "string" + }, + "filters": { + "type": "array", + "items": { "type": "object", - "minProperties": 1, + "required": ["field", "operator", "value"], "properties": { - "name": { + "field": { "type": "string" }, - "email": { + "operator": { + "type": "string" + }, + "value": { "type": "string" } }, "additionalProperties": false } }, - "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": { - "type": "object", - "properties": { - "show": { - "type": "boolean" - } + "label": { + "type": "string" + }, + "meta": { + "type": "object" + }, + "model": { + "type": "string", + "default": "ref('')" + }, + "name": { + "type": "string" + }, + "time_grains": { + "$ref": "#/$defs/array_of_strings" + }, + "timestamp": { + "type": "string" + }, + "window": { + "type": "object", + "properties": { + "count": { + "type": "integer" + }, + "period": { + "type": "string", + "enum": ["day", "week", "month", "year"] } } + } + }, + "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" + } }, - "additionalProperties": false - } - }, - "metrics": { - "type": "array", - "items": { - "type": "object", - "required": ["name", "label", "calculation_method", "expression"], - "if": { + "config": { + "$ref": "#/$defs/model_configs" + }, + "constraints": { + "$ref": "#/$defs/constraints" + }, + "description": { + "type": "string" + }, + "docs": { + "type": "object", "properties": { - "calculation_method": { - "const": "derived" + "show": { + "type": "boolean" } } }, - "then": { - "required": ["name", "label", "calculation_method", "expression"] + "group": { + "type": "string" }, - "else": { - "required": [ - "name", - "model", - "label", - "calculation_method", - "expression" - ] + "latest_version": { + "type": "number" }, - "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" - } - } - }, - "calculation_method": { - "type": "string" - }, - "description": { - "type": "string" - }, - "dimensions": { - "$ref": "#/$defs/array_of_strings" - }, - "expression": { - "type": "string" - }, - "filters": { - "type": "array", - "items": { - "type": "object", - "required": ["field", "operator", "value"], - "properties": { - "field": { - "type": "string" - }, - "operator": { - "type": "string" - }, - "value": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "label": { - "type": "string" - }, - "meta": { - "type": "object" - }, - "model": { - "type": "string", - "default": "ref('')" - }, - "name": { - "type": "string" - }, - "time_grains": { - "$ref": "#/$defs/array_of_strings" - }, - "timestamp": { - "type": "string" + "meta": { + "type": "object" + }, + "tests": { + "type": "array", + "items": { + "$ref": "#/$defs/tests" } }, - "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": { + "versions": { + "type": "array", + "items": { "type": "object", + "required": ["v"], "properties": { - "show": { - "type": "boolean" - } - } - }, - "group": { - "type": "string" - }, - "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" - } - ] - } + "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" + } }, - "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" + }, + "quote_columns": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "schema": { + "type": "string" } - }, - "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" - }, - "quote_columns": { - "$ref": "#/$defs/boolean_or_jinja_string" - }, - "schema": { - "type": "string" - } + } + }, + "description": { + "type": "string" + }, + "docs": { + "type": "object", + "properties": { + "show": { + "type": "boolean" } - }, - "description": { - "type": "string" - }, - "docs": { - "type": "object", - "properties": { - "show": { - "type": "boolean" - } + } + }, + "tests": { + "type": "array", + "items": { + "$ref": "#/$defs/tests" + } + } + }, + "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": { + "type": "object" + }, + "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" } - }, - "tests": { - "type": "array", - "items": { - "$ref": "#/$defs/tests" + } + }, + "description": { + "type": "string" + }, + "docs": { + "type": "object", + "properties": { + "show": { + "type": "boolean" } } }, - "additionalProperties": false - } - }, - "snapshots": { - "type": "array", - "items": { - "type": "object", - "required": ["name"], - "properties": { - "name": { - "type": "string" - }, - "columns": { - "type": "array", - "items": { - "$ref": "#/$defs/column_properties" + "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" } }, - "config": { + "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": { - "alias": { - "type": "string" - }, - "check_cols": { - "$ref": "#/$defs/string_or_array_of_strings" - }, - "enabled": { - "$ref": "#/$defs/boolean_or_jinja_string" - }, - "grants": { - "type": "object" - }, - "persist_docs": { - "$ref": "#/$defs/persist_docs_config" + "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." }, - "post-hook": { - "$ref": "#/$defs/array_of_strings" + "columns": { + "type": "array", + "items": { + "$ref": "#/$defs/column_properties" + } }, - "pre-hook": { - "$ref": "#/$defs/array_of_strings" + "description": { + "type": "string" }, - "quote_columns": { - "$ref": "#/$defs/boolean_or_jinja_string" + "external": { + "type": "object" }, - "strategy": { - "type": "string" + "freshness": { + "$ref": "#/$defs/freshness_definition" }, - "tags": { - "$ref": "#/$defs/string_or_array_of_strings" + "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)" }, - "target_database": { - "type": "string" + "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." }, - "target_schema": { - "type": "string" + "loader": { + "type": "string" }, - "unique_key": { - "$ref": "#/$defs/string_or_array_of_strings" + "meta": { + "type": "object" }, - "updated_at": { - "type": "string" - } - } - }, - "description": { - "type": "string" - }, - "docs": { - "type": "object", - "properties": { - "show": { - "type": "boolean" - } - } - }, - "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" + "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 }, - "identifier": { - "$ref": "#/$defs/boolean_or_jinja_string" + "tags": { + "$ref": "#/$defs/string_or_array_of_strings" }, - "schema": { - "$ref": "#/$defs/boolean_or_jinja_string" + "tests": { + "type": "array", + "items": { + "$ref": "#/$defs/tests" + } } }, "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" - } + } + }, + "tags": { + "$ref": "#/$defs/string_or_array_of_strings" + }, + "tests": { + "type": "array", + "items": { + "$ref": "#/$defs/tests" } } } } + } + }, + "additionalProperties": false, + "$defs": { + "array_of_strings": { + "type": "array", + "items": { + "type": "string" + } }, - "additionalProperties": false, - "$defs": { - "array_of_strings": { - "type": "array", - "items": { - "type": "string" + "boolean_or_jinja_string": { + "oneOf": [ + { + "$ref": "#/$defs/jinja_string" + }, + { + "type": "boolean" } - }, - "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" } - ], - "additionalProperties": false + }, + "quote": { + "$ref": "#/$defs/boolean_or_jinja_string" + }, + "tests": { + "type": "array", + "items": { + "$ref": "#/$defs/tests" + } + }, + "tags": { + "$ref": "#/$defs/string_or_array_of_strings" + } }, - "column_properties": { + "additionalProperties": false + }, + "constraints": { + "type": "array", + "items": { "type": "object", - "required": ["name"], + "required": ["type"], "properties": { - "name": { - "type": "string" - }, - "constraints": { - "$ref": "#/$defs/constraints" + "columns": { + "$ref": "#/$defs/string_or_array_of_strings" }, - "data_type": { + "expression": { "type": "string" }, - "description": { + "name": { "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" - } + "type": { + "type": "string" }, - "quote": { + "warn_unenforced": { "$ref": "#/$defs/boolean_or_jinja_string" }, - "tests": { - "type": "array", - "items": { - "$ref": "#/$defs/tests" - } - }, - "tags": { - "$ref": "#/$defs/string_or_array_of_strings" + "warn_unsupported": { + "$ref": "#/$defs/boolean_or_jinja_string" } + } + } + }, + "freshness_definition": { + "default": { + "warn_after": { + "count": 1, + "period": "day" }, - "additionalProperties": false + "error_after": { + "count": 2, + "period": "day" + } }, - "constraints": { - "type": "array", - "items": { + "oneOf": [ + { "type": "object", - "required": ["type"], "properties": { - "columns": { - "$ref": "#/$defs/string_or_array_of_strings" - }, - "expression": { - "type": "string" + "error_after": { + "$ref": "#/$defs/freshness_rules" }, - "name": { + "filter": { "type": "string" }, - "type": { - "type": "string" - }, - "warn_unenforced": { - "$ref": "#/$defs/boolean_or_jinja_string" - }, - "warn_unsupported": { - "$ref": "#/$defs/boolean_or_jinja_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"] } }, - "freshness_definition": { - "default": { - "warn_after": { - "count": 1, - "period": "day" - }, - "error_after": { - "count": 2, - "period": "day" + "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": "\\{\\{.*\\}\\}" + }, + "model_configs": { + "type": "object", + "properties": { + "contract": { + "type": "object", + "properties": { + "enforced": { + "$ref": "#/$defs/boolean_or_jinja_string" + } } }, - "oneOf": [ - { + "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": { - "error_after": { - "$ref": "#/$defs/freshness_rules" - }, - "filter": { + "database": { "type": "string" }, - "warn_after": { - "$ref": "#/$defs/freshness_rules" + "project": { + "type": "string" } }, "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 - }, - "include_exclude": { - "type": "object", - "properties": { - "include": { - "$ref": "#/$defs/string_or_array_of_strings" + "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}$" + } }, - "exclude": { - "$ref": "#/$defs/string_or_array_of_strings" - } + "additionalProperties": false + }, + "location": { + "type": "string" + }, + "materialized": { + "type": "string" + }, + "sql_header": { + "type": "string" + } + } + }, + "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 } }, - "jinja_string": { - "type": "string", - "pattern": "\\{\\{.*\\}\\}" - }, - "model_configs": { - "type": "object", - "properties": { - "contract": { - "type": "object", - "properties": { - "enforced": { - "$ref": "#/$defs/boolean_or_jinja_string" - } + "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"] } - }, - "grant_access_to": { - "title": "Authorized views", - "type": "array", - "description": "Configuration, specific to BigQuery adapter, used to setup authorized views.", - "items": { + ] + }, + "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": ["database", "project"], + "required": ["to", "field"], "properties": { - "database": { + "name": { "type": "string" }, - "project": { + "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" } - }, - "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": [ - { - "$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": { - "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": { + { + "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": "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" - } + } + }, + { + "title": "Unique Test", + "type": "object", + "properties": { + "unique": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "config": { + "$ref": "#/$defs/test_configs" + }, + "where": { + "type": "string" } } } } - ] - } + } + ] } + } } diff --git a/tests/1.5/invalid/dbt_project.yml b/tests/1.5/invalid/dbt_project.yml index 95041ca..9584d5b 100644 --- a/tests/1.5/invalid/dbt_project.yml +++ b/tests/1.5/invalid/dbt_project.yml @@ -3,12 +3,12 @@ # 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' +name: "test" +version: "1.0.0" config-version: 2 # This setting configures which "profile" dbt uses for this project. -profile: 'test' +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 @@ -20,12 +20,11 @@ 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-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 @@ -44,6 +43,11 @@ seeds: test: +enabled: false +tests: + test: + +enabled: never + +severity: plaid + metrics: - test: - invalid: true \ No newline at end of file + test: + invalid: true diff --git a/tests/1.5/valid/schema.yml b/tests/1.5/valid/schema.yml index 277f4f3..0731c87 100644 --- a/tests/1.5/valid/schema.yml +++ b/tests/1.5/valid/schema.yml @@ -25,13 +25,13 @@ models: group: analytics latest_version: 2 config: - contract: + contract: enforced: true columns: - name: id description: "The primary key for this table" data_type: int - constraints: + constraints: - type: not_null - type: unique - type: check @@ -42,44 +42,42 @@ models: versions: - v: 2 columns: - - include: '*' + - include: "*" exclude: country_name - - name: id # included in addition the '*' set. if 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 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 - + - type: check + expression: (id > 0) + - type: primary_key + columns: [id] + - type: unique + columns: [color, date_day] + name: strange_uniqueness_requirement snapshots: - name: snapshot_name description: slowly changing dimension columns: - - name: id + - name: id description: cool column, eh? - -# model groups +# model groups groups: - name: analytics owner: name: dave - + metrics: - name: new_customers label: New Customers marked 'paying' @@ -98,13 +96,13 @@ metrics: filters: - field: is_paying - operator: '=' - value: 'true' + operator: "=" + value: "true" - field: company_name - operator: '!=' + operator: "!=" value: "Acme', Inc" - meta: + meta: team: "Finance" refresh_rate: "Bob's weekly run" @@ -113,4 +111,8 @@ metrics: description: "The number of paid customers using the product" calculation_method: derived - expression: "{{ metric('new_customers') }} * 2" + expression: "{{ metric('new_customers') }} * 2" + + window: + count: 14 + period: day From d4fdd23d87bcf3144f992e1a54e76a799555f406 Mon Sep 17 00:00:00 2001 From: Dave Connors Date: Wed, 21 Jun 2023 10:01:46 -0500 Subject: [PATCH 05/14] add dependencies.yml --- .github/workflows/ci.yml | 5 +++++ .vscode/settings.json | 5 ++++- schemas/dependencies-1.6.json | 22 ++++++++++++++++++++++ tests/1.6/invalid/dependencies.yml | 2 ++ tests/1.6/valid/dependencies.yml | 2 ++ 5 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 schemas/dependencies-1.6.json create mode 100644 tests/1.6/invalid/dependencies.yml create mode 100644 tests/1.6/valid/dependencies.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fae40a8..b5bec71 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -59,6 +59,11 @@ jobs: npx ajv-cli test -s schemas/selectors-1.6.json -d tests/1.6/valid/selectors.yml --valid npx ajv-cli test -s schemas/selectors-1.6.json -d tests/1.6/invalid/selectors.yml --invalid + - name: Validate dependencies.yml sample files for dbt version 1.6 + run: | + npx ajv-cli test -s schemas/dependencies-1.6.json -d tests/1.6/valid/dependencies.yml --valid + npx ajv-cli test -s schemas/dependencies-1.6.json -d tests/1.6/invalid/dependencies.yml --invalid + validate_plusless_properties: runs-on: ubuntu-latest steps: diff --git a/.vscode/settings.json b/.vscode/settings.json index 5ab9a40..30c610a 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -25,6 +25,7 @@ "!dbt_project.yml", "!packages.yml", "!selectors.yml", + "!dependencies.yml", "!profile_template.yml", "!/.github/**/*.yml" ], @@ -36,7 +37,9 @@ ], "./schemas/packages-1.6.json": [ "/tests/1.6/**/packages.yml" - + ], + "./schemas/dependencies-1.6.json": [ + "/tests/1.6/**/dependencies.yml" ] }, diff --git a/schemas/dependencies-1.6.json b/schemas/dependencies-1.6.json new file mode 100644 index 0000000..fd9a065 --- /dev/null +++ b/schemas/dependencies-1.6.json @@ -0,0 +1,22 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "title": "dependencies", + "required": ["projects"], + "properties": { + "projects": { + "type": "array", + "items": { + "type": "object", + "required": ["name"], + "properties": { + "name": { + "type": "string" + } + }, + "additionalProperties": false + } + } + }, + "additionalProperties": false +} diff --git a/tests/1.6/invalid/dependencies.yml b/tests/1.6/invalid/dependencies.yml new file mode 100644 index 0000000..31deefc --- /dev/null +++ b/tests/1.6/invalid/dependencies.yml @@ -0,0 +1,2 @@ +projects: + - gnome: my_dbt_project diff --git a/tests/1.6/valid/dependencies.yml b/tests/1.6/valid/dependencies.yml new file mode 100644 index 0000000..0201ec8 --- /dev/null +++ b/tests/1.6/valid/dependencies.yml @@ -0,0 +1,2 @@ +projects: + - name: my_dbt_project From f15edec01cf61097f2b1a4ebf0d99c5d46abeb5f Mon Sep 17 00:00:00 2001 From: Dave Connors Date: Tue, 27 Jun 2023 11:26:38 -0500 Subject: [PATCH 06/14] reorganize folders --- .vscode/settings.json | 18 +++++++++--------- schemas/{ => 1.5}/dbt_project-1.5.json | 0 schemas/{ => 1.5}/dbt_yml_files-1.5.json | 0 schemas/{ => 1.5}/packages-1.5.json | 0 schemas/{ => 1.5}/selectors-1.5.json | 0 schemas/{ => 1.6}/dbt_project-1.6.json | 0 schemas/{ => 1.6}/dbt_yml_files-1.6.json | 0 schemas/{ => 1.6}/dependencies-1.6.json | 0 schemas/{ => 1.6}/packages-1.6.json | 0 schemas/{ => 1.6}/selectors-1.6.json | 0 schemas/{ => default}/dbt_project.json | 0 schemas/{ => default}/dbt_yml_files.json | 0 schemas/{ => default}/packages.json | 0 schemas/{ => default}/selectors.json | 0 14 files changed, 9 insertions(+), 9 deletions(-) rename schemas/{ => 1.5}/dbt_project-1.5.json (100%) rename schemas/{ => 1.5}/dbt_yml_files-1.5.json (100%) rename schemas/{ => 1.5}/packages-1.5.json (100%) rename schemas/{ => 1.5}/selectors-1.5.json (100%) rename schemas/{ => 1.6}/dbt_project-1.6.json (100%) rename schemas/{ => 1.6}/dbt_yml_files-1.6.json (100%) rename schemas/{ => 1.6}/dependencies-1.6.json (100%) rename schemas/{ => 1.6}/packages-1.6.json (100%) rename schemas/{ => 1.6}/selectors-1.6.json (100%) rename schemas/{ => default}/dbt_project.json (100%) rename schemas/{ => default}/dbt_yml_files.json (100%) rename schemas/{ => default}/packages.json (100%) rename schemas/{ => default}/selectors.json (100%) diff --git a/.vscode/settings.json b/.vscode/settings.json index 30c610a..c99121e 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,6 +1,6 @@ { "yaml.schemas": { - "./schemas/dbt_yml_files-1.5.json": [ + "./schemas/1.5/dbt_yml_files-1.5.json": [ "/tests/1.5/**/*.yml", "!profiles.yml", "!dbt_project.yml", @@ -9,17 +9,17 @@ "!profile_template.yml", "!/.github/**/*.yml" ], - "./schemas/dbt_project-1.5.json": [ + "./schemas/1.5/dbt_project-1.5.json": [ "/tests/1.5/**/dbt_project.yml" ], - "./schemas/selectors-1.5.json": [ + "./schemas/1.5/selectors-1.5.json": [ "/tests/1.5/**/selectors.yml" ], - "./schemas/packages-1.5.json": [ + "./schemas/1.5/packages-1.5.json": [ "/tests/1.5/**/packages.yml" ], - "./schemas/dbt_yml_files-1.6.json": [ + "./schemas/1.6/dbt_yml_files-1.6.json": [ "/tests/1.6/**/*.yml", "!profiles.yml", "!dbt_project.yml", @@ -29,16 +29,16 @@ "!profile_template.yml", "!/.github/**/*.yml" ], - "./schemas/dbt_project-1.6.json": [ + "./schemas/1.6/dbt_project-1.6.json": [ "/tests/1.6/**/dbt_project.yml" ], - "./schemas/selectors-1.6.json": [ + "./schemas/1.6/selectors-1.6.json": [ "/tests/1.6/**/selectors.yml" ], - "./schemas/packages-1.6.json": [ + "./schemas/1.6/packages-1.6.json": [ "/tests/1.6/**/packages.yml" ], - "./schemas/dependencies-1.6.json": [ + "./schemas/1.6/dependencies-1.6.json": [ "/tests/1.6/**/dependencies.yml" ] diff --git a/schemas/dbt_project-1.5.json b/schemas/1.5/dbt_project-1.5.json similarity index 100% rename from schemas/dbt_project-1.5.json rename to schemas/1.5/dbt_project-1.5.json diff --git a/schemas/dbt_yml_files-1.5.json b/schemas/1.5/dbt_yml_files-1.5.json similarity index 100% rename from schemas/dbt_yml_files-1.5.json rename to schemas/1.5/dbt_yml_files-1.5.json diff --git a/schemas/packages-1.5.json b/schemas/1.5/packages-1.5.json similarity index 100% rename from schemas/packages-1.5.json rename to schemas/1.5/packages-1.5.json diff --git a/schemas/selectors-1.5.json b/schemas/1.5/selectors-1.5.json similarity index 100% rename from schemas/selectors-1.5.json rename to schemas/1.5/selectors-1.5.json diff --git a/schemas/dbt_project-1.6.json b/schemas/1.6/dbt_project-1.6.json similarity index 100% rename from schemas/dbt_project-1.6.json rename to schemas/1.6/dbt_project-1.6.json diff --git a/schemas/dbt_yml_files-1.6.json b/schemas/1.6/dbt_yml_files-1.6.json similarity index 100% rename from schemas/dbt_yml_files-1.6.json rename to schemas/1.6/dbt_yml_files-1.6.json diff --git a/schemas/dependencies-1.6.json b/schemas/1.6/dependencies-1.6.json similarity index 100% rename from schemas/dependencies-1.6.json rename to schemas/1.6/dependencies-1.6.json diff --git a/schemas/packages-1.6.json b/schemas/1.6/packages-1.6.json similarity index 100% rename from schemas/packages-1.6.json rename to schemas/1.6/packages-1.6.json diff --git a/schemas/selectors-1.6.json b/schemas/1.6/selectors-1.6.json similarity index 100% rename from schemas/selectors-1.6.json rename to schemas/1.6/selectors-1.6.json diff --git a/schemas/dbt_project.json b/schemas/default/dbt_project.json similarity index 100% rename from schemas/dbt_project.json rename to schemas/default/dbt_project.json diff --git a/schemas/dbt_yml_files.json b/schemas/default/dbt_yml_files.json similarity index 100% rename from schemas/dbt_yml_files.json rename to schemas/default/dbt_yml_files.json diff --git a/schemas/packages.json b/schemas/default/packages.json similarity index 100% rename from schemas/packages.json rename to schemas/default/packages.json diff --git a/schemas/selectors.json b/schemas/default/selectors.json similarity index 100% rename from schemas/selectors.json rename to schemas/default/selectors.json From 58f08f6f799568304b1d5ddf6e54d5ba8f7d42b9 Mon Sep 17 00:00:00 2001 From: Dave Connors Date: Tue, 27 Jun 2023 11:34:30 -0500 Subject: [PATCH 07/14] use matrix in CI --- .github/workflows/ci.yml | 45 +++++++++++++++------------------------- 1 file changed, 17 insertions(+), 28 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b5bec71..e073e07 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,6 +16,9 @@ jobs: run: npm install --no-save ajv-cli@5.0.0 - name: validate all schema files run: find ./schemas -name "*.json" | xargs -n 1 -I {} npx ajv-cli compile -s {} --strict=false + strategy: + matrix: + dbt-version: ["1.5", "1.6"] test-against-sample-dbt-files: runs-on: ubuntu-latest steps: @@ -25,39 +28,25 @@ jobs: node-version: 16 - name: install avj run: npm install --no-save ajv-cli@5.0.0 - - name: Validate dbt_project.yml sample files for dbt version 1.5 + - name: Validate dbt_project.yml sample files for dbt version {{ matrix.dbt-version }} run: | - npx ajv-cli test -s schemas/dbt_project-1.5.json -d tests/1.5/valid/dbt_project.yml --valid - npx ajv-cli test -s schemas/dbt_project-1.5.json -d tests/1.5/invalid/dbt_project.yml --invalid - - name: Validate resource yml sample files for dbt version 1.5 + npx ajv-cli test -s schemas/{{ matrix.dbt-version }}/dbt_project-{{ matrix.dbt-version }}.json -d tests/{{ matrix.dbt-version }}/valid/dbt_project.yml --valid + npx ajv-cli test -s schemas/{{ matrix.dbt-version }}/dbt_project-{{ matrix.dbt-version }}.json -d tests/{{ matrix.dbt-version }}/invalid/dbt_project.yml --invalid + + - name: Validate resource yml sample files for dbt version {{ matrix.dbt-version }} run: | - npx ajv-cli test -s schemas/dbt_yml_files-1.5.json -d tests/1.5/valid/schema.yml --valid - npx ajv-cli test -s schemas/dbt_yml_files-1.5.json -d tests/1.5/invalid/schema.yml --invalid - - name: Validate packages.yml sample files for dbt version 1.5 - run: | - npx ajv-cli test -s schemas/packages-1.5.json -d tests/1.5/valid/packages.yml --valid - npx ajv-cli test -s schemas/packages-1.5.json -d tests/1.5/invalid/packages.yml --invalid - - name: Validate selectors.yml sample files for dbt version 1.5 - run: | - npx ajv-cli test -s schemas/selectors-1.5.json -d tests/1.5/valid/selectors.yml --valid - npx ajv-cli test -s schemas/selectors-1.5.json -d tests/1.5/invalid/selectors.yml --invalid + npx ajv-cli test -s schemas/{{ matrix.dbt-version }}/dbt_yml_files-{{ matrix.dbt-version }}.json -d tests/{{ matrix.dbt-version }}/valid/schema.yml --valid + npx ajv-cli test -s schemas/{{ matrix.dbt-version }}/dbt_yml_files-{{ matrix.dbt-version }}.json -d tests/{{ matrix.dbt-version }}/invalid/schema.yml --invalid - - name: Validate dbt_project.yml sample files for dbt version 1.6 + - name: Validate packages.yml sample files for dbt version {{ matrix.dbt-version }} run: | - npx ajv-cli test -s schemas/dbt_project-1.6.json -d tests/1.6/valid/dbt_project.yml --valid - npx ajv-cli test -s schemas/dbt_project-1.6.json -d tests/1.6/invalid/dbt_project.yml --invalid - - name: Validate resource yml sample files for dbt version 1.6 - run: | - npx ajv-cli test -s schemas/dbt_yml_files-1.6.json -d tests/1.6/valid/schema.yml --valid - npx ajv-cli test -s schemas/dbt_yml_files-1.6.json -d tests/1.6/invalid/schema.yml --invalid - - name: Validate packages.yml sample files for dbt version 1.6 - run: | - npx ajv-cli test -s schemas/packages-1.6.json -d tests/1.6/valid/packages.yml --valid - npx ajv-cli test -s schemas/packages-1.6.json -d tests/1.6/invalid/packages.yml --invalid - - name: Validate selectors.yml sample files for dbt version 1.6 + npx ajv-cli test -s schemas/{{ matrix.dbt-version }}/packages-{{ matrix.dbt-version }}.json -d tests/{{ matrix.dbt-version }}/valid/packages.yml --valid + npx ajv-cli test -s schemas/{{ matrix.dbt-version }}/packages-{{ matrix.dbt-version }}.json -d tests/{{ matrix.dbt-version }}/invalid/packages.yml --invalid + + - name: Validate selectors.yml sample files for dbt version 1.5 run: | - npx ajv-cli test -s schemas/selectors-1.6.json -d tests/1.6/valid/selectors.yml --valid - npx ajv-cli test -s schemas/selectors-1.6.json -d tests/1.6/invalid/selectors.yml --invalid + npx ajv-cli test -s schemas/{{ matrix.dbt-version }}/selectors-{{ matrix.dbt-version }}.json -d tests/{{ matrix.dbt-version }}/valid/selectors.yml --valid + npx ajv-cli test -s schemas/{{ matrix.dbt-version }}/selectors-{{ matrix.dbt-version }}.json -d tests/{{ matrix.dbt-version }}/invalid/selectors.yml --invalid - name: Validate dependencies.yml sample files for dbt version 1.6 run: | From 81b195485ca703d6e47a8a74160c0fbaae3d3181 Mon Sep 17 00:00:00 2001 From: Dave Connors Date: Tue, 27 Jun 2023 11:36:35 -0500 Subject: [PATCH 08/14] update filepaths --- tests/validate_plusless_properties.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/validate_plusless_properties.py b/tests/validate_plusless_properties.py index cd20f8f..3168737 100644 --- a/tests/validate_plusless_properties.py +++ b/tests/validate_plusless_properties.py @@ -2,9 +2,9 @@ from jsondiff import diff PROJECT_SCHEMA_FILES = [ - "./schemas/dbt_project.json", - "./schemas/dbt_project-1.5.json", - "./schemas/dbt_project-1.6.json" + "./schemas/default/dbt_project.json", + "./schemas/1.5/dbt_project-1.5.json", + "./schemas/1.6/dbt_project-1.6.json" ] def check_equivalency(key, node_type, node_properties): From dcbf6da56083c3039d39092466d35ab1d29d09f5 Mon Sep 17 00:00:00 2001 From: Dave Connors Date: Tue, 27 Jun 2023 11:37:49 -0500 Subject: [PATCH 09/14] matrix syntax --- .github/workflows/ci.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e073e07..573bc39 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,25 +28,25 @@ jobs: node-version: 16 - name: install avj run: npm install --no-save ajv-cli@5.0.0 - - name: Validate dbt_project.yml sample files for dbt version {{ matrix.dbt-version }} + - name: Validate dbt_project.yml sample files for dbt version ${{ matrix.dbt-version }} run: | - npx ajv-cli test -s schemas/{{ matrix.dbt-version }}/dbt_project-{{ matrix.dbt-version }}.json -d tests/{{ matrix.dbt-version }}/valid/dbt_project.yml --valid - npx ajv-cli test -s schemas/{{ matrix.dbt-version }}/dbt_project-{{ matrix.dbt-version }}.json -d tests/{{ matrix.dbt-version }}/invalid/dbt_project.yml --invalid + npx ajv-cli test -s schemas/${{ matrix.dbt-version }}/dbt_project-${{ matrix.dbt-version }}.json -d tests/${{ matrix.dbt-version }}/valid/dbt_project.yml --valid + npx ajv-cli test -s schemas/${{ matrix.dbt-version }}/dbt_project-${{ matrix.dbt-version }}.json -d tests/${{ matrix.dbt-version }}/invalid/dbt_project.yml --invalid - - name: Validate resource yml sample files for dbt version {{ matrix.dbt-version }} + - name: Validate resource yml sample files for dbt version ${{ matrix.dbt-version }} run: | - npx ajv-cli test -s schemas/{{ matrix.dbt-version }}/dbt_yml_files-{{ matrix.dbt-version }}.json -d tests/{{ matrix.dbt-version }}/valid/schema.yml --valid - npx ajv-cli test -s schemas/{{ matrix.dbt-version }}/dbt_yml_files-{{ matrix.dbt-version }}.json -d tests/{{ matrix.dbt-version }}/invalid/schema.yml --invalid + npx ajv-cli test -s schemas/${{ matrix.dbt-version }}/dbt_yml_files-${{ matrix.dbt-version }}.json -d tests/${{ matrix.dbt-version }}/valid/schema.yml --valid + npx ajv-cli test -s schemas/${{ matrix.dbt-version }}/dbt_yml_files-${{ matrix.dbt-version }}.json -d tests/${{ matrix.dbt-version }}/invalid/schema.yml --invalid - - name: Validate packages.yml sample files for dbt version {{ matrix.dbt-version }} + - name: Validate packages.yml sample files for dbt version ${{ matrix.dbt-version }} run: | - npx ajv-cli test -s schemas/{{ matrix.dbt-version }}/packages-{{ matrix.dbt-version }}.json -d tests/{{ matrix.dbt-version }}/valid/packages.yml --valid - npx ajv-cli test -s schemas/{{ matrix.dbt-version }}/packages-{{ matrix.dbt-version }}.json -d tests/{{ matrix.dbt-version }}/invalid/packages.yml --invalid + npx ajv-cli test -s schemas/${{ matrix.dbt-version }}/packages-${{ matrix.dbt-version }}.json -d tests/${{ matrix.dbt-version }}/valid/packages.yml --valid + npx ajv-cli test -s schemas/${{ matrix.dbt-version }}/packages-${{ matrix.dbt-version }}.json -d tests/${{ matrix.dbt-version }}/invalid/packages.yml --invalid - name: Validate selectors.yml sample files for dbt version 1.5 run: | - npx ajv-cli test -s schemas/{{ matrix.dbt-version }}/selectors-{{ matrix.dbt-version }}.json -d tests/{{ matrix.dbt-version }}/valid/selectors.yml --valid - npx ajv-cli test -s schemas/{{ matrix.dbt-version }}/selectors-{{ matrix.dbt-version }}.json -d tests/{{ matrix.dbt-version }}/invalid/selectors.yml --invalid + npx ajv-cli test -s schemas/${{ matrix.dbt-version }}/selectors-${{ matrix.dbt-version }}.json -d tests/${{ matrix.dbt-version }}/valid/selectors.yml --valid + npx ajv-cli test -s schemas/${{ matrix.dbt-version }}/selectors-${{ matrix.dbt-version }}.json -d tests/${{ matrix.dbt-version }}/invalid/selectors.yml --invalid - name: Validate dependencies.yml sample files for dbt version 1.6 run: | From b8f5701e7389de3155061e8c1f803b9703e9d53c Mon Sep 17 00:00:00 2001 From: Dave Connors Date: Tue, 27 Jun 2023 11:39:04 -0500 Subject: [PATCH 10/14] move matrix' --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 573bc39..296ae87 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,10 +16,10 @@ jobs: run: npm install --no-save ajv-cli@5.0.0 - name: validate all schema files run: find ./schemas -name "*.json" | xargs -n 1 -I {} npx ajv-cli compile -s {} --strict=false + test-against-sample-dbt-files: strategy: matrix: dbt-version: ["1.5", "1.6"] - test-against-sample-dbt-files: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 From 38afeac61e9176868c8e10385dcffb7ca9ded6c9 Mon Sep 17 00:00:00 2001 From: Dave Connors Date: Tue, 27 Jun 2023 11:55:57 -0500 Subject: [PATCH 11/14] rename files for CI matrix strategy --- .github/workflows/ci.yml | 27 +++++-------------- .../invalid/{schema.yml => dbt_yml_files.yml} | 0 .../valid/{schema.yml => dbt_yml_files.yml} | 0 .../invalid/{schema.yml => dbt_yml_files.yml} | 0 .../valid/{schema.yml => dbt_yml_files.yml} | 0 5 files changed, 6 insertions(+), 21 deletions(-) rename tests/1.5/invalid/{schema.yml => dbt_yml_files.yml} (100%) rename tests/1.5/valid/{schema.yml => dbt_yml_files.yml} (100%) rename tests/1.6/invalid/{schema.yml => dbt_yml_files.yml} (100%) rename tests/1.6/valid/{schema.yml => dbt_yml_files.yml} (100%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 296ae87..6d0e228 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,6 +20,10 @@ jobs: strategy: matrix: dbt-version: ["1.5", "1.6"] + dbt-file-name: ["dbt_project", "packages", "selectors", "dbt_yml_files", "dependencies"] + exclude: + - dbt-version: "1.5" + dbt-file-name: "dependencies" runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -30,28 +34,9 @@ jobs: run: npm install --no-save ajv-cli@5.0.0 - name: Validate dbt_project.yml sample files for dbt version ${{ matrix.dbt-version }} run: | - npx ajv-cli test -s schemas/${{ matrix.dbt-version }}/dbt_project-${{ matrix.dbt-version }}.json -d tests/${{ matrix.dbt-version }}/valid/dbt_project.yml --valid - npx ajv-cli test -s schemas/${{ matrix.dbt-version }}/dbt_project-${{ matrix.dbt-version }}.json -d tests/${{ matrix.dbt-version }}/invalid/dbt_project.yml --invalid + npx ajv-cli test -s schemas/${{ matrix.dbt-version }}/${{ matrix.dbt-file-name }}/-${{ matrix.dbt-version }}.json -d tests/${{ matrix.dbt-version }}/valid/${{ matrix.dbt-file-name }}.yml --valid + npx ajv-cli test -s schemas/${{ matrix.dbt-version }}/${{ matrix.dbt-file-name }}-${{ matrix.dbt-version }}.json -d tests/${{ matrix.dbt-version }}/invalid/${{ matrix.dbt-file-name }}.yml --invalid - - name: Validate resource yml sample files for dbt version ${{ matrix.dbt-version }} - run: | - npx ajv-cli test -s schemas/${{ matrix.dbt-version }}/dbt_yml_files-${{ matrix.dbt-version }}.json -d tests/${{ matrix.dbt-version }}/valid/schema.yml --valid - npx ajv-cli test -s schemas/${{ matrix.dbt-version }}/dbt_yml_files-${{ matrix.dbt-version }}.json -d tests/${{ matrix.dbt-version }}/invalid/schema.yml --invalid - - - name: Validate packages.yml sample files for dbt version ${{ matrix.dbt-version }} - run: | - npx ajv-cli test -s schemas/${{ matrix.dbt-version }}/packages-${{ matrix.dbt-version }}.json -d tests/${{ matrix.dbt-version }}/valid/packages.yml --valid - npx ajv-cli test -s schemas/${{ matrix.dbt-version }}/packages-${{ matrix.dbt-version }}.json -d tests/${{ matrix.dbt-version }}/invalid/packages.yml --invalid - - - name: Validate selectors.yml sample files for dbt version 1.5 - run: | - npx ajv-cli test -s schemas/${{ matrix.dbt-version }}/selectors-${{ matrix.dbt-version }}.json -d tests/${{ matrix.dbt-version }}/valid/selectors.yml --valid - npx ajv-cli test -s schemas/${{ matrix.dbt-version }}/selectors-${{ matrix.dbt-version }}.json -d tests/${{ matrix.dbt-version }}/invalid/selectors.yml --invalid - - - name: Validate dependencies.yml sample files for dbt version 1.6 - run: | - npx ajv-cli test -s schemas/dependencies-1.6.json -d tests/1.6/valid/dependencies.yml --valid - npx ajv-cli test -s schemas/dependencies-1.6.json -d tests/1.6/invalid/dependencies.yml --invalid validate_plusless_properties: runs-on: ubuntu-latest diff --git a/tests/1.5/invalid/schema.yml b/tests/1.5/invalid/dbt_yml_files.yml similarity index 100% rename from tests/1.5/invalid/schema.yml rename to tests/1.5/invalid/dbt_yml_files.yml diff --git a/tests/1.5/valid/schema.yml b/tests/1.5/valid/dbt_yml_files.yml similarity index 100% rename from tests/1.5/valid/schema.yml rename to tests/1.5/valid/dbt_yml_files.yml diff --git a/tests/1.6/invalid/schema.yml b/tests/1.6/invalid/dbt_yml_files.yml similarity index 100% rename from tests/1.6/invalid/schema.yml rename to tests/1.6/invalid/dbt_yml_files.yml diff --git a/tests/1.6/valid/schema.yml b/tests/1.6/valid/dbt_yml_files.yml similarity index 100% rename from tests/1.6/valid/schema.yml rename to tests/1.6/valid/dbt_yml_files.yml From 82525f62f92c5cf8dd6e4cabe50707139dc08305 Mon Sep 17 00:00:00 2001 From: Dave Connors Date: Tue, 27 Jun 2023 11:57:07 -0500 Subject: [PATCH 12/14] we love a typo --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6d0e228..558dacd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,7 +34,7 @@ jobs: run: npm install --no-save ajv-cli@5.0.0 - name: Validate dbt_project.yml sample files for dbt version ${{ matrix.dbt-version }} run: | - npx ajv-cli test -s schemas/${{ matrix.dbt-version }}/${{ matrix.dbt-file-name }}/-${{ matrix.dbt-version }}.json -d tests/${{ matrix.dbt-version }}/valid/${{ matrix.dbt-file-name }}.yml --valid + npx ajv-cli test -s schemas/${{ matrix.dbt-version }}/${{ matrix.dbt-file-name }}-${{ matrix.dbt-version }}.json -d tests/${{ matrix.dbt-version }}/valid/${{ matrix.dbt-file-name }}.yml --valid npx ajv-cli test -s schemas/${{ matrix.dbt-version }}/${{ matrix.dbt-file-name }}-${{ matrix.dbt-version }}.json -d tests/${{ matrix.dbt-version }}/invalid/${{ matrix.dbt-file-name }}.yml --invalid From b5db613415bd8353f52db73a80f23b47cd7c9d2f Mon Sep 17 00:00:00 2001 From: Dave Connors Date: Wed, 28 Jun 2023 09:00:49 -0500 Subject: [PATCH 13/14] move default files to root so as to not break the IDE --- schemas/{default => }/dbt_project.json | 0 schemas/{default => }/dbt_yml_files.json | 0 schemas/{default => }/packages.json | 0 schemas/{default => }/selectors.json | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename schemas/{default => }/dbt_project.json (100%) rename schemas/{default => }/dbt_yml_files.json (100%) rename schemas/{default => }/packages.json (100%) rename schemas/{default => }/selectors.json (100%) diff --git a/schemas/default/dbt_project.json b/schemas/dbt_project.json similarity index 100% rename from schemas/default/dbt_project.json rename to schemas/dbt_project.json diff --git a/schemas/default/dbt_yml_files.json b/schemas/dbt_yml_files.json similarity index 100% rename from schemas/default/dbt_yml_files.json rename to schemas/dbt_yml_files.json diff --git a/schemas/default/packages.json b/schemas/packages.json similarity index 100% rename from schemas/default/packages.json rename to schemas/packages.json diff --git a/schemas/default/selectors.json b/schemas/selectors.json similarity index 100% rename from schemas/default/selectors.json rename to schemas/selectors.json From 0c6d629f8e5363a3099aa043012b9a841ee70ba6 Mon Sep 17 00:00:00 2001 From: Dave Connors Date: Wed, 28 Jun 2023 09:13:25 -0500 Subject: [PATCH 14/14] fix CI --- tests/validate_plusless_properties.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/validate_plusless_properties.py b/tests/validate_plusless_properties.py index 3168737..c497df2 100644 --- a/tests/validate_plusless_properties.py +++ b/tests/validate_plusless_properties.py @@ -2,7 +2,7 @@ from jsondiff import diff PROJECT_SCHEMA_FILES = [ - "./schemas/default/dbt_project.json", + "./schemas/dbt_project.json", "./schemas/1.5/dbt_project-1.5.json", "./schemas/1.6/dbt_project-1.6.json" ]