Skip to content

Remove need to specify specific version #884

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

Merged
merged 1 commit into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ sidebar_position: 30
hide_table_of_contents: true
---

import { DbtCongfigurationPage, JsonToTable, JsonSchemaGenerator } from '@site/src/components/JsonSchemaValidator';
import { DbtCongfigurationPage, JsonToTable, JsonSchemaGenerator, getSchemaVersions } from '@site/src/components/JsonSchemaValidator';
import { dump } from 'js-yaml';
import Admonition from '@theme/Admonition';
import DbtSchemas from "@site/docs/reusable/dbt-schemas/_index.md";
Expand Down Expand Up @@ -36,7 +36,7 @@ export const printYamlVariables = (data) => {

export const MyMdxComponent = () => {
const schemaName = 'dbtAttribution';
const versions = ['0.2.0', '0.1.0'];
const versions = getSchemaVersions(schemaName);
const label = 'dbt attribution version';
const output = printYamlVariables;
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ sidebar_position: 40
hide_table_of_contents: true
---

import { DbtCongfigurationPage, JsonToTable, JsonSchemaGenerator } from '@site/src/components/JsonSchemaValidator';
import { DbtCongfigurationPage, JsonToTable, JsonSchemaGenerator, getSchemaVersions } from '@site/src/components/JsonSchemaValidator';
import { dump } from 'js-yaml';
import Admonition from '@theme/Admonition';
import DbtSchemas from "@site/docs/reusable/dbt-schemas/_index.md";
Expand Down Expand Up @@ -58,7 +58,7 @@ export const printYamlVariables = (data) => {

export const MyMdxComponent = () => {
const schemaName = 'dbtEcommerce';
const versions = ['0.8.2', '0.8.1','0.8.0', '0.7.1', '0.7.0', '0.6.1', '0.6.0', '0.5.4'];
const versions = getSchemaVersions(schemaName);
const label = 'dbt e-commerce version';
const output = printYamlVariables;
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ hide_table_of_contents: true
The Fractribution Package is no longer maintained, please refer to the [Attribution package](/docs/modeling-your-data/modeling-your-data-with-dbt/dbt-models/dbt-attribution-data-model/) for marketing attribution analysis with Snowplow
:::

import { DbtCongfigurationPage, JsonToTable, JsonSchemaGenerator } from '@site/src/components/JsonSchemaValidator';
import { DbtCongfigurationPage, JsonToTable, JsonSchemaGenerator, getSchemaVersions } from '@site/src/components/JsonSchemaValidator';
import { dump } from 'js-yaml';
import Admonition from '@theme/Admonition';
import DbtSchemas from "@site/docs/reusable/dbt-schemas/_index.md";
Expand Down Expand Up @@ -38,7 +38,7 @@ export const printYamlVariables = (data) => {

export const MyMdxComponent = () => {
const schemaName = 'dbtFractribution';
const versions = ['0.3.6', '0.3.5'];
const versions = getSchemaVersions(schemaName);
const label = 'dbt fractribution version';
const output = printYamlVariables;
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This package has been superseded by the [Unified Digital](/docs/modeling-your-da

:::

import { DbtCongfigurationPage, JsonToTable, JsonSchemaGenerator } from '@site/src/components/JsonSchemaValidator';
import { DbtCongfigurationPage, JsonToTable, JsonSchemaGenerator, getSchemaVersions } from '@site/src/components/JsonSchemaValidator';
import { dump } from 'js-yaml';
import Admonition from '@theme/Admonition';
import DbtSchemas from "@site/docs/reusable/dbt-schemas/_index.md";
Expand Down Expand Up @@ -63,7 +63,7 @@ export const printYamlVariables = (data) => {

export const MyMdxComponent = () => {
const schemaName = 'dbtMobile';
const versions = ['1.0.0', '0.7.4'];
const versions = getSchemaVersions(schemaName);
const label = 'dbt mobile version';
const output = printYamlVariables;
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This package has been superseded by the [Unified Digital](/docs/modeling-your-da

:::

import { DbtCongfigurationPage, JsonToTable, JsonSchemaGenerator } from '@site/src/components/JsonSchemaValidator';
import { DbtCongfigurationPage, JsonToTable, JsonSchemaGenerator, getSchemaVersions } from '@site/src/components/JsonSchemaValidator';
import { dump } from 'js-yaml';
import Admonition from '@theme/Admonition';
import DbtSchemas from "@site/docs/reusable/dbt-schemas/_index.md";
Expand Down Expand Up @@ -61,7 +61,7 @@ export const printYamlVariables = (data) => {

export const MyMdxComponent = () => {
const schemaName = 'dbtWeb';
const versions = ['1.0.1', '1.0.0', '0.16.2', '0.16.1', '0.16.0', '0.15.2'];
const versions = getSchemaVersions(schemaName);
const label = 'dbt web version';
const output = printYamlVariables;
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ sidebar_position: 20
hide_table_of_contents: true
---

import { DbtCongfigurationPage, JsonToTable, JsonSchemaGenerator } from '@site/src/components/JsonSchemaValidator';
import { DbtCongfigurationPage, JsonToTable, JsonSchemaGenerator, getSchemaVersions } from '@site/src/components/JsonSchemaValidator';
import { dump } from 'js-yaml';
import Admonition from '@theme/Admonition';
import DbtSchemas from "@site/docs/reusable/dbt-schemas/_index.md";
Expand Down Expand Up @@ -54,7 +54,7 @@ export const printYamlVariables = (data) => {

export const MyMdxComponent = () => {
const schemaName = 'dbtMediaPlayer';
const versions = ['0.7.2','0.7.1', '0.7.0', '0.6.1'];
const versions = getSchemaVersions(schemaName);
const label = 'dbt media player version';
const output = printYamlVariables;
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ sidebar_position: 50
hide_table_of_contents: true
---

import { DbtCongfigurationPage, JsonToTable, JsonSchemaGenerator } from '@site/src/components/JsonSchemaValidator';
import { DbtCongfigurationPage, JsonToTable, JsonSchemaGenerator, getSchemaVersions } from '@site/src/components/JsonSchemaValidator';
import { dump } from 'js-yaml';
import Admonition from '@theme/Admonition';
import DbtSchemas from "@site/docs/reusable/dbt-schemas/_index.md";
Expand Down Expand Up @@ -38,7 +38,7 @@ export const printYamlVariables = (data) => {

export const MyMdxComponent = () => {
const schemaName = 'dbtNormalize';
const versions = ['0.3.5','0.3.4','0.3.3'];
const versions = getSchemaVersions(schemaName);
const label = 'dbt normalize version';
const output = printYamlVariables;
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ sidebar_position: 10
hide_table_of_contents: true
---

import { DbtCongfigurationPage, JsonToTable, JsonSchemaGenerator } from '@site/src/components/JsonSchemaValidator';
import { DbtCongfigurationPage, JsonToTable, JsonSchemaGenerator, getSchemaVersions } from '@site/src/components/JsonSchemaValidator';
import { dump } from 'js-yaml';
import Admonition from '@theme/Admonition';
import DbtSchemas from "@site/docs/reusable/dbt-schemas/_index.md";
Expand Down Expand Up @@ -55,7 +55,7 @@ export const printYamlVariables = (data) => {

export const MyMdxComponent = () => {
const schemaName = 'dbtUnified';
const versions = ['0.4.0', '0.3.1', '0.3.0', '0.2.0', '0.1.2'];
const versions = getSchemaVersions(schemaName);
const label = 'dbt unified version';
const output = printYamlVariables;
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ sidebar_position: 60
hide_table_of_contents: true
---

import { DbtCongfigurationPage, JsonToTable, JsonSchemaGenerator } from '@site/src/components/JsonSchemaValidator';
import { DbtCongfigurationPage, JsonToTable, JsonSchemaGenerator, getSchemaVersions } from '@site/src/components/JsonSchemaValidator';
import { dump } from 'js-yaml';
import Admonition from '@theme/Admonition';
import DbtSchemas from "@site/docs/reusable/dbt-schemas/_index.md";
Expand Down Expand Up @@ -35,7 +35,7 @@ export const printYamlVariables = (data) => {

export const MyMdxComponent = () => {
const schemaName = 'dbtUtils';
const versions = ['0.16.5', '0.16.4', '0.16.3', '0.16.2', '0.16.1', '0.16.0', '0.15.2'];
const versions = getSchemaVersions(schemaName);
const label = 'dbt utils version';
const output = printYamlVariables;
return (
Expand Down
14 changes: 14 additions & 0 deletions src/components/JsonSchemaValidator/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,3 +275,17 @@ export function DbtCongfigurationPage({ schemaName, versions, label, children })
<SelectSchemaVersion versions={versions} label={label} />
)
}


// Function to return a list of versions from the schema folder that start with a specific name
export function getSchemaVersions(schemaName) {
const schemaVersions = [];
Object.keys(schemaImports).forEach((key) => {
if (key.startsWith(schemaName)) {
schemaVersions.push(key.split('_')[1]);
}
});
// reverse it
schemaVersions.reverse();
return schemaVersions;
}