Skip to content

Commit

Permalink
Merge pull request #236 from mfontanini/validate-config-file-schema
Browse files Browse the repository at this point in the history
Validate config file schema
  • Loading branch information
mfontanini authored Apr 1, 2024
2 parents 6f0933e + 3833ef2 commit 16f0d18
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 2 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/merge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,14 @@ jobs:
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Verify assets
- name: Validate assets
run: ./bat/verify.sh

json-schemas:
name: Validate JSON schemas
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Validate config file schema
run: ./scripts/validate-config-file-schema.sh
File renamed without changes.
2 changes: 1 addition & 1 deletion config.sample.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# yaml-language-server: $schema=./schema.json
# yaml-language-server: $schema=https://raw.githubusercontent.com/mfontanini/presenterm/master/config-file-schema.json
defaults:
# override the terminal font size when in windows or when using sixel.
terminal_font_size: 16
Expand Down
16 changes: 16 additions & 0 deletions scripts/validate-config-file-schema.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

script_dir=$(dirname "$0")
root_dir="${script_dir}/../"

current_schema=$(mktemp)
cargo run -q -- --generate-config-file-schema >"$current_schema"

diff=$(diff --color=always -u "${root_dir}/config-file-schema.json" "$current_schema")
if [ $? -ne 0 ]; then
echo "Config file JSON schema differs:"
echo "$diff"
exit 1
else
echo "Config file JSON schema is up to date"
fi

0 comments on commit 16f0d18

Please sign in to comment.