https://github.com/iterative/dvcyaml-schema
Schema for dvc.yaml
https://github.com/iterative/dvcyaml-schema
dvc dvc-yaml jsonschema
Last synced: about 1 year ago
JSON representation
Schema for dvc.yaml
- Host: GitHub
- URL: https://github.com/iterative/dvcyaml-schema
- Owner: iterative
- License: apache-2.0
- Created: 2020-06-16T15:48:23.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2025-04-07T18:23:08.000Z (about 1 year ago)
- Last Synced: 2025-04-10T10:44:34.809Z (about 1 year ago)
- Topics: dvc, dvc-yaml, jsonschema
- Language: Python
- Homepage: https://dvc.org/doc/user-guide/project-structure/dvcyaml-files
- Size: 76.2 KB
- Stars: 13
- Watchers: 12
- Forks: 2
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# dvcyaml-schema
[JSON Schema](https://json-schema.org/) for [`dvc.yaml`](https://dvc.org/doc/user-guide/dvc-files-and-directories#dvcyaml-file) file format, generated using [Pydantic](https://docs.pydantic.dev/latest/).
It can provide better autocompletion, validation, and linting for `dvc.yaml` files.
## Usage
#### Visual Studio Code (with [YAML Extension](https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml)):
If you have installed the [YAML Extension](https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml), 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:
```json
{
"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.)
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](https://www.jetbrains.com/help/ruby/yaml.html#remote_json) for assistance.
#### Other Editors
`dvc.yaml` schema is available in [JSON Schema Store](https://www.schemastore.org/json/), 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.
### Important Files:
1. **[schema.json](schema.json)**
2. [gen.py](gen.py)
3. [examples](examples)
4. [tests.py](tests.py)
### Contributing
1. Setup your environment (you'll need `python3.10+` and `pip`).
```console
$ python3 -m venv .venv
$ source .venv/bin/activate
$ pip install -r requirements.txt
$ pre-commit install
```
2. Generate the schema.
The schema is generated using [Pydantic](https://docs.pydantic.dev/latest/) through the [gen.py](gen.py) script. You can make adjustments to the script as needed.
To manually generate the schema, run:
```console
$ ./gen.py schema.json
```
3. (Optional) Add [valid](examples/valid) and [invalid](examples/invalid) yaml examples.
4. Run tests using:
```console
$ pytest
```
5. Git-add the changes and then commit. `pre-commit` hook should run automatically and format/lint code, regenerate new schema, and run tests.
```console
$ git add -p
$ git commit -m ""
```
If the hook makes additional changes, stage them and attempt the commit again.
6. Send us a pull request. 🤗