Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
skshetry authored Nov 23, 2024
1 parent a20427e commit 1a8553e
Showing 1 changed file with 39 additions and 19 deletions.
58 changes: 39 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,16 @@
# 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.
[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

### 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](https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml)):

If you have installed YAML extension, it'll automatically fetch the latest dvcyaml-schema, and
should work out of the box.
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.

But you can specify explicitly as well by adding following contents to your settings:
Alternatively, you can explicitly configure it by adding the following to your settings:

```json
{
Expand All @@ -34,7 +25,23 @@ You can also specify custom URL or path instead for debugging/testing purposes.

#### JetBrain IDEs (PyCharm, Intellij IDEA, et al.)

Follow [this](https://www.jetbrains.com/help/ruby/yaml.html#remote_json) instruction.
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.


If you need 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
```




### Important Files:

Expand All @@ -45,19 +52,32 @@ Follow [this](https://www.jetbrains.com/help/ruby/yaml.html#remote_json) instruc

### Contributing

1. Prepare your environment (you'll need `python3.10+` and `pip`).
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
```
2. Install `pre-commit` hook.
```console
$ pip install pre-commit
$ pre-commit install
```
3. Open [gen.py](gen.py), make some adjustments.
3. 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:
```
$ ./gen.py schema.json
```

4. (Optional) Add [valid](examples/valid) and [invalid](examples/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. 🤗
5. Run tests using:
```
$ pytest
```
6. Commit. `pre-commit` hook should run automatically and format/lint code, regenerate new schema, and run tests.
If the hook makes additional changes, stage them and attempt the commit again.

8. Send us a pull request. 🤗

0 comments on commit 1a8553e

Please sign in to comment.