Skip to content

Commit 780a482

Browse files
Switch to jsonschema for definition validation
updates the workflow that produces test output so that the YAML file is checked against the schema first uses JSON Schema's format instead of yamale's so we can use LSP with LSP-json to validate the schema and use LSP with LSP-yaml to validate YAML code adds an option to validate the YAML file locally against the schema
1 parent d24ee6f commit 780a482

File tree

9 files changed

+673
-125
lines changed

9 files changed

+673
-125
lines changed

.github/workflows/pre-commit.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ jobs:
1010
pre-commit:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v4
14-
- uses: actions/setup-python@v5
13+
- uses: actions/checkout@v6
14+
- uses: actions/setup-python@v6
1515
with:
1616
python-version: 3.x
1717
- uses: pre-commit/action@v3.0.1

.github/workflows/validate.yaml

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Validate LSL Definitions
1+
name: Validate LSL definitions via jsonschema and test syntax generation
22

33
on:
44
pull_request:
@@ -7,11 +7,10 @@ on:
77
tags: [v*]
88

99
jobs:
10-
validate-definitions:
10+
validate-lsl-definitions-via-jsonschema:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- name: Checkout code
14-
uses: actions/checkout@v4
13+
- uses: actions/checkout@v6
1514

1615
- name: Set up Python
1716
uses: actions/setup-python@v5
@@ -23,9 +22,27 @@ jobs:
2322
python -m pip install --upgrade pip
2423
pip install .
2524
26-
- name: Validate yaml schema's with Yamale
25+
- name: Validate LSL definitions via jsonschema
2726
run: |
28-
yamale -s lsl_definitions.schema.yaml lsl_definitions.yaml
27+
# Run command to check the lsl_definitions against the schema file, to verify it's valid
28+
validate-lsl-definitions-via-jsonschema
29+
echo "✓ Definitions file matches schema"
30+
31+
test-generating-syntax:
32+
needs: validate-lsl-definitions-via-jsonschema
33+
runs-on: ubuntu-latest
34+
steps:
35+
- uses: actions/checkout@v6
36+
37+
- name: Set up Python
38+
uses: actions/setup-python@v5
39+
with:
40+
python-version: '3.x'
41+
42+
- name: Install dependencies
43+
run: |
44+
python -m pip install --upgrade pip
45+
pip install .
2946
3047
- name: Check if syntax generation produces valid output
3148
run: |

.gitignore

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
1+
# macOS / General
2+
3+
.DS_Store
4+
5+
# macOS / Thumbnails
6+
7+
._*
8+
9+
# Microsoft Windows / Folder config file
10+
11+
[Dd]esktop.ini
12+
13+
# Python
14+
15+
__pycache__/
16+
*.py[cod]
17+
18+
# Other
19+
120
*.egg-info/
2-
*.pyc
321
.ruff_cache/
422
.venv/
5-
__pycache__/

.pre-commit-config.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
repos:
22
- repo: https://github.com/astral-sh/ruff-pre-commit
3-
rev: v0.12.1
3+
rev: v0.14.7
44
hooks:
55
- id: ruff-check
66
- id: ruff-format
77
- repo: https://github.com/pre-commit/pre-commit-hooks
8-
rev: v5.0.0
8+
rev: v6.0.0
99
hooks:
10+
- id: check-json
1011
- id: check-yaml
1112
args: [--allow-multiple-documents]
1213
- id: end-of-file-fixer

0 commit comments

Comments
 (0)