Skip to content
This repository has been archived by the owner on Feb 23, 2022. It is now read-only.

Commit

Permalink
Add JSON schema to validate Adventure YAMLs
Browse files Browse the repository at this point in the history
  • Loading branch information
rix0rrr committed Apr 25, 2021
1 parent ae3eef8 commit 731bc9d
Show file tree
Hide file tree
Showing 9 changed files with 2,224 additions and 7 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/unittests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,6 @@ jobs:
- name: Test with unittest
run: |
python -m unittest discover -s tests
- name: Validate YAML
run: build-tools/validate-yaml

29 changes: 29 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,32 @@ Pre-release environment
When you have your PR accepted into `master`, that version will be deployed on [hedy-alpha.herokuapp.com](https://hedy-alpha.herokuapp.com).

We do periodic deploys of `master` to the [production version](https://hedycode.com) of Hedy.

Editing YAML files with validation
----------------------------------

If you need to edit the YAML files that make up the Hedy adventure mode,
you can have them validated as-you-type against our JSON schemas.

This does require some manual configuration in your IDE, which we can
unfortunately not do automatically for you. What you need to do depends
on which IDE you are using. Here are the IDEs we know about:

### Visual Studio Code

* Install the Vistual Studio Code [YAML plugin](https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml)
* After installing the plugin, press **F1**, and type **Preferences: Open Worspace Settings (JSON)**.
* Add the following `yaml.schemas` key to the JSON file that shows up:

```json
{
// ...
"yaml.schemas": {
"coursedata/adventures/adventures.schema.json": "adventures/*.yaml"
}
}
```

### IntelliJ (PyCharm/WebStorm/...)

(Instructions still to figure out)
1 change: 1 addition & 0 deletions build-tools/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
Loading

0 comments on commit 731bc9d

Please sign in to comment.