Added new and updated utils methods for constrains. Also, added integ… #117
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Validate JSON Schemas | |
on: | |
push: | |
branches: | |
- '**' | |
jobs: | |
validate-schemas: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.22' | |
- name: Install jv | |
run: | | |
go install github.com/santhosh-tekuri/jsonschema/cmd/jv@latest | |
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH | |
- name: Validate JSON schemas | |
run: | | |
for file in $(find ./.schema/test/ -name "*.hery"); do | |
echo "Validating $file" | |
tmpfile="${file%.hery}.yaml" | |
mv "$file" "$tmpfile" | |
if [[ $file == *invalid.hery ]]; then | |
if jv ./.schema/entity.schema.json "$tmpfile"; then | |
echo "Error: $file is invalid but passed validation" | |
mv "$tmpfile" "$file" | |
exit 1 | |
else | |
echo "$file correctly failed validation" | |
mv "$tmpfile" "$file" | |
fi | |
elif [[ $file == *valid.hery ]]; then | |
if jv ./.schema/entity.schema.json "$tmpfile"; then | |
echo "$file correctly passed validation" | |
mv "$tmpfile" "$file" | |
else | |
echo "Error: $file is valid but failed validation" | |
mv "$tmpfile" "$file" | |
exit 1 | |
fi | |
fi | |
done |