-
Notifications
You must be signed in to change notification settings - Fork 169
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix up examples in src/schema/README.md to not use outdated schema pa…
…ths (#1698) * Fix some example paths which no longer correspond * skip example * fixup the fixup * "Fix" example to correspond to current situation May be another simpler example should be chosen? * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Add missing (gzip, ome, tiff) context objects * Make helper to check paths in example to take arg to point to schema.org + add it to RTD workflow * Install jq in RTD * Make script actually exit with non-0 if anything is unreachable * list jq in apt_packages --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
c9e4779
commit 2fc8982
Showing
3 changed files
with
53 additions
and
16 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/bash | ||
|
||
set -eu -o pipefail | ||
|
||
schema_json=$(readlink -f "$1") | ||
|
||
cd "$(dirname "$(readlink -f "$0")")/../src/schema" | ||
|
||
# Create a temporary file and ensure it gets deleted on exit | ||
tmpfile=$(mktemp) | ||
trap 'rm -f "$tmpfile"' EXIT | ||
|
||
grep -oE '(://)?([-_A-Za-z]+\.)+[-_A-Za-z]+' README.md \ | ||
| grep -v -e :// -e '\.\(md\|html\|json\|tsv\|yaml\)$' \ | ||
| grep -e '^\(meta\|objects\|rules\)' \ | ||
| grep -v 'objects.metadata.OtherObjectName' \ | ||
| sort | uniq | \ | ||
while IFS= read -r p; do | ||
v=$(jq ".$p" < "$schema_json" | grep -v '^null$' || echo "fail") | ||
if [ -z "$v" ] || [ "$v" = "fail" ]; then | ||
echo "$p: not reachable" >> "$tmpfile" | ||
fi | ||
done | ||
|
||
# Check if the temporary file is empty | ||
if [ -s "$tmpfile" ]; then | ||
cat "$tmpfile" # Display the not reachable paths | ||
exit 1 | ||
fi |