Skip to content

Commit e1b1034

Browse files
committed
Implement JSON Schema for PGXN Meta Spec v1
Based on the descriptions in `spec.md` and the validation in pgxn/pgxn-meta-validator, write JSON Schema v2020 schemas to validate PGXN Meta Spec `META.json` files. The implementation should be at least as good as the old one, now portable for use in other languages. In the process, correct a few issues and errors discovered in `spec.md` and increment its version to v1.0.2. Add a test suite in Rust that uses the boon crate to verify that the schemas, their IDs, and their examples are valid. This sets the stage for writing a validation utility in Rust. To keep things tidy and somewhat standardized, add a pre-commit configuration to lint the JSON and Rust code. Then setup a GitHub workflow to run the tests on macOS, Windows, and Linux, and the pre-commit linting on Linux. Overkill for now, since there is no Rust library, just tests for the JSON Schema, but likely to be needed before long.
1 parent aff1854 commit e1b1034

26 files changed

+1230
-14
lines changed

.github/workflows/test-and-lint.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: 🧪 Test and Lint
2+
on:
3+
push:
4+
branches-ignore: [wip/**]
5+
jobs:
6+
test:
7+
strategy:
8+
matrix:
9+
os: [[🐧, Ubuntu], [🍎, macOS], [🪟, Windows]]
10+
toolchain: ["stable", "beta", "nightly"]
11+
name: 🦀 ${{ matrix.toolchain }} on ${{ matrix.os[0] }} ${{ matrix.os[1] }}
12+
runs-on: ${{ matrix.os[1] }}-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
- name: Setup Rust Cache
17+
uses: Swatinem/rust-cache@v2
18+
- name: Setup Rust
19+
uses: dtolnay/rust-toolchain@stable
20+
with: { toolchain: "${{ matrix.toolchain }}" }
21+
- name: Test
22+
run: make test
23+
24+
lint:
25+
name: 🔎 Lint and Cover
26+
runs-on: ubuntu-latest
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@v4
30+
- name: Setup Rust Cache
31+
uses: Swatinem/rust-cache@v2
32+
- name: Setup Rust
33+
uses: dtolnay/rust-toolchain@stable
34+
- name: Run pre-commit
35+
uses: pre-commit/[email protected]

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
/.vscode
1+
.DS_Store
2+
.idea/
3+
/target
4+
.vscode/
5+
vendor/

.pre-commit-config.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# auth-global hooks will be managed / updated across all auth repos.
2+
repos:
3+
- repo: https://github.com/pre-commit/pre-commit-hooks
4+
rev: v4.6.0
5+
hooks:
6+
- id: trailing-whitespace
7+
name: Lint trailing whitespace
8+
exclude_types: [image]
9+
- id: end-of-file-fixer
10+
name: Lint end-of-file newline
11+
exclude_types: [image]
12+
- id: check-added-large-files
13+
name: Don't permit large files
14+
exclude_types: [image]
15+
16+
- repo: https://github.com/backplane/pre-commit-rust-hooks
17+
rev: v1.1.0
18+
hooks:
19+
- id: fmt
20+
- id: check
21+
- id: clippy
22+
- id: test
23+
24+
- repo: https://github.com/pre-commit/mirrors-prettier
25+
rev: v3.1.0
26+
hooks:
27+
- id: prettier
28+
name: JSON and YAML formatting
29+
types_or: [json, yaml]

Cargo.lock

Lines changed: 320 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)