JSON Schema for dvc.yaml
file format, generated using Pydantic.
It can provide better autocompletion, validation, and linting for dvc.yaml
files.
Visual Studio Code (with YAML Extension):
If you have installed the YAML Extension, it will automatically fetch the latest dvc.yaml
schema, and work out of the box.
Alternatively, you can explicitly configure it by adding the following to your settings:
{
"yaml.schemas": {
"https://raw.githubusercontent.com/iterative/dvcyaml-schema/master/schema.json":
"dvc.yaml"
}
}
You can also specify custom URL or path instead for debugging/testing purposes.
JetBrain IDEs automatically fetch the latest dvc.yaml
schema and should work without additional setup.
If you're using an older version or encounter any issues, refer to this guide for assistance.
dvc.yaml
schema is available in JSON Schema Store, so it will be pulled automatically in editors that support it
natively or through plugins.
To add it manually, use the following URL to obtain the latest JSON schema for dvc.yaml
:
https://raw.githubusercontent.com/iterative/dvcyaml-schema/master/schema.json
Check the documentation of your specific editor or IDE for details on how to configure schemas.
-
Setup your environment (you'll need
python3.10+
andpip
).$ python3 -m venv .venv $ source .venv/bin/activate $ pip install -r requirements.txt $ pre-commit install
-
Generate the schema.
The schema is generated using Pydantic through the gen.py script. You can make adjustments to the script as needed.
To manually generate the schema, run:
$ ./gen.py schema.json
-
Run tests using:
$ pytest
-
Git-add the changes and then commit.
pre-commit
hook should run automatically and format/lint code, regenerate new schema, and run tests.$ git add -p $ git commit -m "<message>"
If the hook makes additional changes, stage them and attempt the commit again.
-
Send us a pull request. 🤗