zed/script/update-json-schemas
Peter Tripp e0f77d16fb
Update bundled JSON schemas (2026-04-29) (#58948)
./script/update-json-schemas 16c22767

- Improved `script/update-json-schemas`
  - Fix paths to match new locations of schemas
  - Add support for specifying an explicit commit
  - Use sed to replace `json.` links with `www.` in schemas
- Updated JSON schemas to
[SchemaStore/schemastore@16c2276](16c227677c)
(2026-04-29; last updated 2025-02-28)
-
[tsconfig.json](https://github.com/SchemaStore/schemastore/commits/master/src/schemas/json/tsconfig.json)
@
[16c2276](https://raw.githubusercontent.com/SchemaStore/schemastore/16c227677c1cb71864593f63382705e8c7390810/src/schemas/json/tsconfig.json)
-
[changes](https://github.com/SchemaStore/schemastore/commits/16c227677c1cb71864593f63382705e8c7390810/src/schemas/json/tsconfig.json)
-
[package.json](https://github.com/SchemaStore/schemastore/commits/master/src/schemas/json/package.json)
@
[16c2276](https://raw.githubusercontent.com/SchemaStore/schemastore/16c227677c1cb71864593f63382705e8c7390810/src/schemas/json/package.json)
-
[changes](https://github.com/SchemaStore/schemastore/commits/16c227677c1cb71864593f63382705e8c7390810/src/schemas/json/package.json)
- Updates tsconfig.json to support ES2025 stuff.
- Updates package.json to support `nodemonConfig`

Note, this is pinned to an old commit
(16c22767) because
anything after https://github.com/SchemaStore/schemastore/pull/5631 will
result in errors for all referenced schemas in package.json. This occurs
as they are all now relative links, which cannot be resolved for the
schema injected via config. This is also a hint that the current method
of bundling of package.json schema in practice triggers json-language
fetching 8 other nested schemas. Probably worth revisiting that.

CC: @probably-neb as someone who recently worked on the schemastore
stuff.

Self-Review Checklist:

- [Yes] I've reviewed my own diff for quality, security, and reliability
- [N/A] Unsafe blocks (if any) have justifying comments
- [N/A] The content adheres to Zed's UI standards
([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
and
[icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md)
guidelines)
- [N/A] Tests cover the new/changed behavior
- [N/A] Performance impact has been considered and is acceptable

Release Notes:

- Update bundled tsconfig.json and package.json schemas

---------

Co-authored-by: Ben Kunkle <ben.kunkle@gmail.com>
2026-06-25 17:30:12 +00:00

40 lines
1.3 KiB
Bash
Executable file

#!/usr/bin/env bash
set -euo pipefail
cd "$(dirname "$0")/.." || exit 1
cd crates/json_schema_store/src/schemas
if [[ $# -gt 1 ]]; then
echo "Usage: script/update-json-schemas [schemastore-commit]" >&2
exit 1
fi
UPSTREAM_REF="${1:-master}"
COMMIT="$(curl -sL "https://api.github.com/repos/SchemaStore/schemastore/commits/$UPSTREAM_REF")"
HASH="$(jq -r '.sha' <<< "$COMMIT")"
if [[ -z "$HASH" || "$HASH" == "null" ]]; then
echo "Failed to resolve SchemaStore/schemastore commit: $UPSTREAM_REF" >&2
exit 1
fi
files=(
"tsconfig.json"
"package.json"
)
for file in "${files[@]}"; do
curl -sL "https://raw.githubusercontent.com/SchemaStore/schemastore/$HASH/src/schemas/json/$file" |
sed 's|https://json\.schemastore\.org|https://www.schemastore.org|g' > "$file"
done
SHORT_HASH="${HASH:0:7}"
DATE="$(jq -r .commit.author.date <<< "$COMMIT" | cut -c1-10)"
echo
echo "Updated JSON schemas to [SchemaStore/schemastore@$SHORT_HASH](https://github.com/SchemaStore/schemastore/tree/$HASH) ($DATE)"
echo
for file in "${files[@]}"; do
echo "- [$file](https://github.com/SchemaStore/schemastore/commits/master/src/schemas/json/$file)" \
"@ [$SHORT_HASH](https://raw.githubusercontent.com/SchemaStore/schemastore/$HASH/src/schemas/json/$file)"
done
echo