Skip to content

Commit

Permalink
feat: pipeline who check json validity (#258)
Browse files Browse the repository at this point in the history
* feat: pipeline who check json validity

* feat: test errors

* feat: only jsonld

* feat: only jsonld

* feat: only jsonld

* feat: only jsonld

* fix: DeviceStation.json

* fix: remove space from name

* fix: remaining spaces

* feat: always check all filer

* feat: always check all filer

* feat: always check all filer

* feat: always check all filer

* feat: always check all filer
  • Loading branch information
thomasBousselin authored Jan 27, 2025
1 parent dcd42ab commit ff14fce
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 1 deletion.
43 changes: 43 additions & 0 deletions .github/workflows/check_json_validity.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Check JSON-LD and JSON files are valid

on:
workflow_dispatch:
push:
branches:
- '**'
paths:
- '**/jsonld-contexts/**'
- '**/ngsild-payloads/**'

jobs:
check-context-valid-json:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Install jq
run: |
sudo apt update && sudo apt install jq
- name: Check JSON and JSON-LD files
run: |
error=0
echo "Checking JSON-LD files"
for file in $(find . -name "*.jsonld"); do
printf "Checking $file .. "
jq empty $file && echo "OK" || { error=1; echo "****************** KO invalid JSON ******************"; }
done
echo ""
echo "Checking JSON files"
for file in $(find . -name "*.json"); do
printf "Checking $file .. "
jq empty $file && echo "OK" || { error=1; echo "****************** KO invalid JSON ******************"; }
done
exit $error
shell: bash
- name: Check JSON files
run: |
error=0
exit $error
shell: bash
3 changes: 2 additions & 1 deletion archive/precipitation/ngsild-payloads/DeviceStation.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@
"@context": [
"https://easy-global-market.github.io/ngsild-api-data-models/precipitation/jsonld-contexts/precipitationCompouned.jsonld"
]
}
}
}

0 comments on commit ff14fce

Please sign in to comment.