-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix model validation, add CI #16
Merged
Merged
Changes from 1 commit
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
cd9f896
make column_properties/required an arrary
kochalex 6dfaf17
escape regex
kochalex 0a3e477
fix cli for installing ajv-cli
kochalex 2e9ab96
escape regexes in the other files, get them passing validation
kochalex 7143ae0
add node_modules to gitignore
kochalex 4e2492b
update npm cli to not write package.json & lock file
kochalex ebefcf3
ci job testing against real files
kochalex 0ee4eaa
remove cache key from jobs, not using package.json
kochalex 00bb9db
job is using fixture files as a test, not running dbt init
kochalex 7d3f8de
Fix model validation (#1)
kochalex 3172d09
Apply suggestions from code review: dbt is lowercase
kochalex 3fa782f
add $schema to schema files
kochalex 8720855
Merge branch 'fix-model-validation' into main
kochalex 74931eb
identifier has http, do not need to specify draft7 to ajv cli
kochalex File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: CI | ||
|
||
on: pull_request | ||
|
||
jobs: | ||
validate-json-schemas: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
- name: install avj | ||
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 --spec=draft7 | ||
test-against-sample-dbt-files: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
- name: install avj | ||
run: npm install --no-save ajv-cli@5.0.0 | ||
- name: validate dbt_project.yml sample file | ||
run: npx ajv-cli validate -s schemas/dbt_project.json -d tests/dbt_project.yml | ||
- name: validate sample model YAML file | ||
run: npx ajv-cli validate -s schemas/dbt_yml_files.json -d tests/schema.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
|
||
.DS_Store | ||
node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# this file was generated with dbt init with DBT 1.2.1 | ||
kochalex marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# this file was generated with dbt init with DBT 1.2.1 | ||
kochalex marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
version: 2 | ||
|
||
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 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per https://json-schema.org/understanding-json-schema/reference/regular_expressions.html