Skip to content

Commit ebfcf6a

Browse files
committed
add: tool to validate if declared opposites exist
1 parent c2149be commit ebfcf6a

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

tools/validate_opposites.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
3+
opposites=$(cat relationships/definition.json | grep '"opposite"' | cut -d ':' -f 2 | tr -d ' ' | tr -d '"')
4+
5+
for opposite in $opposites
6+
do
7+
cat relationships/definition.json | grep '"name": "'$opposite'"' >/dev/null 2>&1
8+
res=$?
9+
if [ "$res" -eq 1 ]
10+
then
11+
echo "'$opposite' not found"
12+
exit 1
13+
fi
14+
done
15+
16+
echo "OK, all opposites seem to point to existing relationships"
17+
exit 0

0 commit comments

Comments
 (0)