Get real-time validation, autocomplete, and inline documentation for your Datafold monitors-as-code configurations!
Read more about monitors-as-code in our docs
- Overview
- VSCode Setup (Recommended)
- IntelliJ/PyCharm Setup
- Other Editors
- Inline Schema Reference
- Troubleshooting
- Examples
Datafold provides a JSON Schema that enables your editor to:
- Validate your monitor configurations in real-time
- Autocomplete field names and values
- Show documentation on hover
- Suggest valid configuration options
- Highlight errors with helpful messages
Schema URL:
https://raw.githubusercontent.com/datafold/monitors-schema/main/schema.json
- Open VSCode/Cursor
- Open "Extensions" (Press
Ctrl+Shift+X(Windows/Linux) orCmd+Shift+X(Mac)) - Search for "YAML" by Red Hat
- Click Install
Or install directly: YAML Extension by Red Hat
Choose Option A (workspace-specific) or Option B (user-wide):
Create or edit .vscode/settings.json in your project root:
{
"yaml.schemas": {
"https://raw.githubusercontent.com/datafold/monitors-schema/main/schema.json": [
"monitors.yaml",
"monitors.yml",
"**/monitors/**/*.yaml",
"**/monitors/**/*.yml",
"**/*-monitors.yaml",
"**/*-monitors.yml"
]
},
"yaml.customTags": [
"!include scalar",
"!include_dir_list scalar"
]
}This configuration applies validation to any file matching the patterns above.
- Press
Ctrl+,(Windows/Linux) orCmd+,(Mac) to open Settings - Search for
yaml.schemas - Click "Edit in settings.json"
- Add the same configuration as Option A
- Open or create a file named
monitors.yaml - Start typing and you should see:
- Autocomplete suggestions
- Documentation on hover
- Red underlines for errors
Test with this snippet:
monitors:
test_monitor:
type: test
connection_id: # Hover to see docs!-
Go to Settings/Preferences (
Ctrl+Alt+SorCmd+,) -
Navigate to Languages & Frameworks → Schemas and DTDs → JSON Schema Mappings
-
Click + to add a new mapping
-
Configure the mapping:
Field Value Name Datafold Monitors Schema file or URL https://raw.githubusercontent.com/datafold/monitors-schema/main/schema.jsonSchema version JSON Schema version 7 -
Under File path pattern, click + and add:
monitors.yamlmonitors.yml- Or custom patterns like
*-monitors.yaml
- Click OK to save
- Open a monitor configuration file
- Validation should work automatically!
Most modern editors support JSON Schema validation for YAML files:
Install yaml-language-server:
npm install -g yaml-language-serverConfigure in your LSP setup (e.g., with nvim-lspconfig):
require'lspconfig'.yamlls.setup {
settings = {
yaml = {
schemas = {
["https://raw.githubusercontent.com/datafold/monitors-schema/main/schema.json"] = "monitors*.{yaml,yml}"
}
}
}
}{
"settings": {
"yaml.schemas": {
"https://raw.githubusercontent.com/datafold/monitors-schema/main/schema.json": ["monitors*.{yaml,yml}"]
}
}
}Use lsp-mode with yaml-language-server:
(use-package lsp-mode
:hook (yaml-mode . lsp)
:config
(setq lsp-yaml-schemas
'(:https://raw.githubusercontent.com/datafold/monitors-schema/main/schema.json ["monitors*.yaml" "monitors*.yml"])))You can specify the schema directly in your YAML files using a comment:
# yaml-language-server: $schema=https://raw.githubusercontent.com/datafold/monitors-schema/main/schema.json
monitors:
my_monitor:
type: test
connection_id: 123
test:
type: accepted_values
tables:
- path: schema.table
columns: [column1]
variables:
accepted_values:
value: [1, 2, 3]
quote: false
schedule:
interval:
every: hour
notifications: []Benefits:
- Works without editor configuration
- Self-documenting (schema URL is visible)
- Portable (works on any machine)
- Useful for shared snippets
When to use:
- One-off configuration files
- Shared examples and templates
- CI/CD validation scripts
- Files outside standard naming patterns
Problem: Editor shows no validation, autocomplete, or hover docs.
Solutions:
-
Verify YAML extension is installed
- VSCode: Check Extensions panel
- IntelliJ: Check Plugins
-
Check file name patterns
- Ensure your file matches configured patterns (e.g.,
monitors.yaml) - Try adding inline schema reference (see above)
- Ensure your file matches configured patterns (e.g.,
-
Reload editor window
- VSCode:
Ctrl/Cmd+Shift+P→ "Reload Window" - IntelliJ: File → Invalidate Caches / Restart
- VSCode:
-
Verify schema URL is accessible
- Open the URL in a browser to ensure it loads
- Check network/firewall settings
Contact support team.
Happy monitoring! 🎉