Skip to content

Commit

Permalink
adds validation to ensure token file names match coinDenom
Browse files Browse the repository at this point in the history
  • Loading branch information
julia-script committed Jan 3, 2024
1 parent 72cf2e2 commit 47e1f3c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions validate-tokens.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
for file in $(find ./tokens -name '*.json'); do
# Validate the file against the schema
if ! ajv validate -s ./schema.token.json -d "$file" --spec=draft2020 --errors=text; then
exit 1
fi

filename=$(basename "$file" .json)
coinDenom=$(jq -r '.coinDenom' "$file")

# Compare the filename to the coinDenom value
if [ "$filename" != "$coinDenom" ]; then
echo "Mismatch found: File '$filename.json' name does not match coinDenom '$coinDenom', rename it to '$coinDenom.json'"
exit 1
fi
done


Expand Down

0 comments on commit 47e1f3c

Please sign in to comment.