Skip to content

Allow excluding directories from Databricks bundle YAML schema association in VS Code extension #1849

@magnusasperud

Description

@magnusasperud

Description

When working in a Databricks Asset Bundle project, the VS Code extension automatically associates the databricks-asset-bundles.json schema with YAML files in the workspace. This default behavior is reasonable because many YAML files in a bundle repository belong to the bundle configuration.

However, in some projects the repository also contains other YAML-based configuration files that are unrelated to Databricks bundles.

Currently there does not appear to be a way to exclude specific directories from the Databricks schema association, which prevents using custom YAML schemas for those files.


Use Case

In our repository we maintain ingestion metadata in YAML files with a custom schema. These files are not related to Databricks bundle configuration.

Example structure:

project-root/
└─ .vscode/
│   └─ settings.json
│
├── dab-project/
│   │
│   ├── databricks.yml
│   ├── resources/
│   └── src/
│       └── metadata/
│           ├── company_code.yml
│           └── company_code_text.yml/
└── schemas/
    └── databricks-ingestion.schema.json

These metadata files should use a custom YAML schema configured via the YAML extension:

//settings.json
{
  "yaml.schemas": {
    "schemas/databricks-ingestion.schema.json": [
      "dab-project/src/metadata/*.yml",
    ]
  }
}

Current Workaround

The only reliable workaround is adding a schema directive to every file:

# yaml-language-server: $schema=../../../../schemas/databricks-ingestion.schema.json

This works but is not practical when managing many metadata files.


Proposed Improvement

Provide a way to exclude directories from the Databricks schema association, for example via a workspace setting.

Example concept:

{
  "databricks.bundle.yamlSchemaExclude": [
    "src/metadata/**"
  ]
}

This would allow the YAML extension to apply custom schemas to those directories while keeping the default Databricks schema behavior for bundle configuration files.


Expected Outcome

Users should be able to:

  • keep the default bundle schema behavior
  • define custom YAML schemas for other configuration files in the same repository
  • exclude specific directories from Databricks schema association

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions