Skip to content

Commit

Permalink
merge main:
Browse files Browse the repository at this point in the history
  • Loading branch information
dave-connors-3 committed May 23, 2024
2 parents 6931ae5 + 2434fd9 commit 5a0209a
Show file tree
Hide file tree
Showing 6 changed files with 140 additions and 14 deletions.
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,21 @@ This repository contains schemata for:
```json
{
"yaml.schemas": {
"https://raw.githubusercontent.com/dbt-labs/dbt-jsonschema/main/schemas/dbt_yml_files.json": [
"https://raw.githubusercontent.com/dbt-labs/dbt-jsonschema/main/schemas/latest/dbt_yml_files-latest.json": [
"/**/*.yml",
"!profiles.yml",
"!dbt_project.yml",
"!packages.yml",
"!selectors.yml",
"!profile_template.yml"
],
"https://raw.githubusercontent.com/dbt-labs/dbt-jsonschema/main/schemas/dbt_project.json": [
"https://raw.githubusercontent.com/dbt-labs/dbt-jsonschema/main/schemas/latest/dbt_project-latest.json": [
"dbt_project.yml"
],
"https://raw.githubusercontent.com/dbt-labs/dbt-jsonschema/main/schemas/selectors.json": [
"https://raw.githubusercontent.com/dbt-labs/dbt-jsonschema/main/schemas/latest/selectors-latest.json": [
"selectors.yml"
],
"https://raw.githubusercontent.com/dbt-labs/dbt-jsonschema/main/schemas/packages.json": [
"https://raw.githubusercontent.com/dbt-labs/dbt-jsonschema/main/schemas/latest/packages-latest.json": [
"packages.yml"
]
},
Expand All @@ -56,21 +56,21 @@ This repository contains schemata for:
```json
{
"yaml.schemas": {
"https://raw.githubusercontent.com/dbt-labs/dbt-jsonschema/main/schemas/dbt_yml_files.json": [
"https://raw.githubusercontent.com/dbt-labs/dbt-jsonschema/main/schemas/latest/dbt_yml_files-latest.json": [
"/**/*.yml",
"!profiles.yml",
"!dbt_project.yml",
"!packages.yml",
"!selectors.yml",
"!profile_template.yml"
],
"https://raw.githubusercontent.com/dbt-labs/dbt-jsonschema/main/schemas/dbt_project.json": [
"https://raw.githubusercontent.com/dbt-labs/dbt-jsonschema/main/schemas/latest/dbt_project-latest.json": [
"dbt_project.yml"
],
"https://raw.githubusercontent.com/dbt-labs/dbt-jsonschema/main/schemas/selectors.json": [
"https://raw.githubusercontent.com/dbt-labs/dbt-jsonschema/main/schemas/latest/selectors-latest.json": [
"selectors.yml"
],
"https://raw.githubusercontent.com/dbt-labs/dbt-jsonschema/main/schemas/packages.json": [
"https://raw.githubusercontent.com/dbt-labs/dbt-jsonschema/main/schemas/latest/packages-latest.json": [
"packages.yml"
]
},
Expand All @@ -89,19 +89,19 @@ As we have to manually configure them one by one, we just describe values of the
If you want to know the details, the [dbt YAML validator in JetBrains article](https://yu-ishikawa.medium.com/dbt-yaml-validator-in-jetbrains-b5ef25e9253e) describes how to configure the JSON schema mapping in details.

- Project definition files
- URL: `https://raw.githubusercontent.com/dbt-labs/dbt-jsonschema/main/schemas/dbt_project.json`
- URL: `https://raw.githubusercontent.com/dbt-labs/dbt-jsonschema/main/schemas/latest/dbt_project-latest.json`
- Schema version: JSON schema version 7
- Mapping: `dbt_project.yml`
- Package files
- URL: `https://raw.githubusercontent.com/dbt-labs/dbt-jsonschema/main/schemas/packages.json`
- URL: `https://raw.githubusercontent.com/dbt-labs/dbt-jsonschema/main/schemas/latest/packages-latest.json`
- Schema version: JSON schema version 7
- Mapping: `packages.yml`
- Selectors files
- URL: `https://raw.githubusercontent.com/dbt-labs/dbt-jsonschema/main/schemas/selectors.json`
- URL: `https://raw.githubusercontent.com/dbt-labs/dbt-jsonschema/main/schemas/latest/selectors-latest.json`
- Schema version: JSON schema version 7
- Mapping: `selectors.yml`
- Property files
- URL: `https://raw.githubusercontent.com/dbt-labs/dbt-jsonschema/main/schemas/dbt_yml_files.json`
- URL: `https://raw.githubusercontent.com/dbt-labs/dbt-jsonschema/main/schemas/latest/dbt_yml_files-latest.json`
- Schema version: JSON schema version 7
- Mapping: `models/**/*.yml`, `analysis/**/*.yml`, `snapshots/**/*.yml`

Expand Down
3 changes: 3 additions & 0 deletions schemas/1.6/dbt_yml_files-1.6.json
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,9 @@
"description": {
"type": "string"
},
"deprecation_date": {
"type": "string"
},
"docs": {
"$ref": "#/$defs/docs_config"
},
Expand Down
3 changes: 3 additions & 0 deletions schemas/1.7/dbt_yml_files-1.7.json
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,9 @@
"description": {
"type": "string"
},
"deprecation_date": {
"type": "string"
},
"docs": {
"$ref": "#/$defs/docs_config"
},
Expand Down
79 changes: 79 additions & 0 deletions schemas/latest/dbt_yml_files-latest.json
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,9 @@
"description": {
"type": "string"
},
"deprecation_date": {
"type": "string"
},
"access": {
"type": "string",
"enum": [
Expand Down Expand Up @@ -443,6 +446,51 @@
"additionalProperties": false
}
},
"saved_queries": {
"type": "array",
"items": {
"type": "object",
"required": [
"name",
"description",
"label",
"query_params"
],
"properties": {
"name": {
"type": "string"
},
"description": {
"type": "string"
},
"exports": {
"type": "array",
"items": {
"$ref": "#/$defs/export"
}
},
"label": {
"type": "string"
},
"query_params": {
"type": "object",
"properties": {
"dimensions": {
"$ref": "#/$defs/array_of_strings"
},
"metrics": {
"$ref": "#/$defs/array_of_strings"
},
"where": {
"$ref": "#/$defs/array_of_strings"
},
"additionalProperties": false
}
}
},
"additionalProperties": false
}
},
"seeds": {
"type": "array",
"items": {
Expand Down Expand Up @@ -1379,6 +1427,37 @@
},
"additionalProperties": false
},
"export": {
"type": "object",
"required": [
"name"
],
"properties": {
"name": {
"type": "string"
},
"config": {
"type": "object",
"properties": {
"alias": {
"type": "string"
},
"export_as": {
"enum": [
"table",
"view",
"cache"
]
},
"schema": {
"type": "string"
}
},
"additionalProperties": true
}
},
"additionalProperties": false
},
"freshness_definition": {
"default": {
"error_after": {
Expand Down
24 changes: 23 additions & 1 deletion tests/latest/invalid/dbt_yml_files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,26 @@ unit_tests:
expect:
rows: |
col_1,col_2
val_1,val_2
val_1,val_2
saved_queries:
- name: test_saved_query
description:
term: paper
label: Test saved query
query_params:
metrics: simple_metric
group_by:
- "Dimension('user__ds')"
where:
- "{{ Dimension('user__ds', 'DAY') }} <= now()"
- "{{ Dimension('user__ds', 'DAY') }} >= '2023-01-01'"
exports:
- name: my_export
config:
alias: my_export_alias
export_as: joel
schema:
- my_export_schema_name
- my_export_schema_name_2}
21 changes: 20 additions & 1 deletion tests/latest/valid/dbt_yml_files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -207,4 +207,23 @@ metrics:
denominator:
name: transactions
filter: |
"{{ Dimension('transaction__location') }} = 'US'"
"{{ Dimension('transaction__location') }} = 'US'"
saved_queries:
- name: test_saved_query
description: "{{ doc('saved_query_description') }}"
label: Test saved query
query_params:
metrics:
- simple_metric
group_by:
- "Dimension('user__ds')"
where:
- "{{ Dimension('user__ds', 'DAY') }} <= now()"
- "{{ Dimension('user__ds', 'DAY') }} >= '2023-01-01'"
exports:
- name: my_export
config:
alias: my_export_alias
export_as: table
schema: my_export_schema_name

0 comments on commit 5a0209a

Please sign in to comment.