From 0b2a373b5822cb12a3b3d9c7591148ba7a149f6b Mon Sep 17 00:00:00 2001 From: Dave Connors Date: Wed, 19 Jul 2023 09:09:54 -0500 Subject: [PATCH] allow package specifications in dependencies.yml --- schemas/1.6/dependencies-1.6.json | 63 +++++++++++++++++++++++++++++- tests/1.6/invalid/dependencies.yml | 4 ++ tests/1.6/valid/dependencies.yml | 4 ++ 3 files changed, 70 insertions(+), 1 deletion(-) diff --git a/schemas/1.6/dependencies-1.6.json b/schemas/1.6/dependencies-1.6.json index fd9a065..b17802a 100644 --- a/schemas/1.6/dependencies-1.6.json +++ b/schemas/1.6/dependencies-1.6.json @@ -2,7 +2,6 @@ "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "title": "dependencies", - "required": ["projects"], "properties": { "projects": { "type": "array", @@ -16,6 +15,68 @@ }, "additionalProperties": false } + }, + "packages": { + "type": "array", + "items": { + "anyOf": [ + { + "type": "object", + "required": ["package", "version"], + "properties": { + "version": { + "title": "Package version", + "type": ["string", "number", "array"], + "description": "A semantic version string or range, such as [\">=1.0.0\", \"<2.0.0\"]" + }, + "install-prerelease": { + "title": "Install Prerelease", + "type": "boolean", + "description": "Opt in to prerelease versions of a package" + }, + "package": { + "title": "Package identifier", + "type": "string", + "description": "Must be in format `org_name/package_name`. Refer to hub.getdbt.com for installation instructions", + "examples": ["dbt-labs/dbt_utils"], + "pattern": "^[\\w\\-\\.]+/[\\w\\-\\.]+$" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": ["git"], + "properties": { + "git": { + "title": "Git URL", + "type": "string" + }, + "revision": { + "title": "Revision", + "type": "string", + "description": "Pin your package to a specific release by specifying a release name" + }, + "subdirectory": { + "title": "Subdirectory", + "type": "string", + "description": "Only required if the package is nested in a subdirectory of the git project" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "local": { + "type": "string" + } + }, + "additionalProperties": false + } + ] + }, + "minItems": 1 } }, "additionalProperties": false diff --git a/tests/1.6/invalid/dependencies.yml b/tests/1.6/invalid/dependencies.yml index 31deefc..08bb75c 100644 --- a/tests/1.6/invalid/dependencies.yml +++ b/tests/1.6/invalid/dependencies.yml @@ -1,2 +1,6 @@ projects: - gnome: my_dbt_project + +pancakeages: + - pancake: dbt-labs/dbt-utils + version: 1.0.0 \ No newline at end of file diff --git a/tests/1.6/valid/dependencies.yml b/tests/1.6/valid/dependencies.yml index 0201ec8..19c88c5 100644 --- a/tests/1.6/valid/dependencies.yml +++ b/tests/1.6/valid/dependencies.yml @@ -1,2 +1,6 @@ projects: - name: my_dbt_project + +packages: + - package: dbt-labs/dbt-utils + version: 1.0.0 \ No newline at end of file