/dvcyaml-schema

Schema for dvc.yaml

Primary LanguagePythonApache License 2.0Apache-2.0

dvcyaml-schema

JSON Schema for dvc.yaml file format.

It can provide better autocompletion, validation, and linting for dvc.yaml files.

Usage

JSON Schema

Use the following URL to obtain the latest JSON schema for dvc.yaml:

https://raw.githubusercontent.com/iterative/dvcyaml-schema/master/schema.json

Visual Studio Code (with YAML Extension):

If you have installed YAML extension, it'll automatically fetch the latest dvcyaml-schema, and should work out of the box.

But you can specify explicitly as well by adding following contents 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 (PyCharm, Intellij IDEA, et al.)

Follow this instruction.

Important Files:

  1. schema.json
  2. gen.py
  3. examples
  4. tests.py

Contributing

  1. Prepare your environment (you'll need python3.10+ and pip).
    $ python3 -m venv .venv
    $ source .venv/bin/activate
    $ pip install -r requirements.txt
  2. Install pre-commit hook.
    $ pip install pre-commit
    $ pre-commit install
  3. Open gen.py, make some adjustments.
  4. (Optional) Add valid and invalid yaml examples.
  5. Commit. pre-commit hook should run automatically and format/lint code, generate new schema and run tests. If there are any new changes, add and try to commit it again.
  6. Send us a pull request. 🤗