Skip to content

Jcscottiii/update web features schema json pr3000 #1635

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ frontend/.postinstall
lib/gen/*/*/*.go
lib/gen/*/*/*.ts
lib/gen/featuresearch/**
jsonschema/web-platform-dx_web-features/defs_final.schema.json

# Ignore coverage files
coverage
Expand Down
12 changes: 8 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -181,16 +181,20 @@ download-schemas:
wget -O jsonschema/mdn_browser-compat-data/browsers.schema.json \
https://raw.githubusercontent.com/mdn/browser-compat-data/main/schemas/browsers.schema.json

# Use the workaround in https://github.com/glideapps/quicktype/issues/518 to generate ALL types
# Currently, StringOrStrings and UrlOrURLs cannot be in the same jsonschema because quicktype
# sees that they are the same and tries to optimize. Remove one and keep the other.
jsonschema:
rm -f $(JSONSCHEMA_OUT_DIR)/web_platform_dx__web_features/*.go
cat jsonschema/web-platform-dx_web-features/defs.schema.json | jq 'walk(if type == "string" and . == "#/definitions/URLOrURLs" then "#/definitions/StringOrStrings" else . end) | del(.definitions.URLOrURLs)' > jsonschema/web-platform-dx_web-features/defs_final.schema.json
npx quicktype \
--src jsonschema/web-platform-dx_web-features/defs.schema.json \
--src jsonschema/web-platform-dx_web-features/defs_final.schema.json#/definitions/ \
--src-lang schema \
--lang go \
--top-level FeatureData \
--out $(JSONSCHEMA_OUT_DIR)/web_platform_dx__web_features/feature_data.go \
--top-level WebFeaturesData \
--out $(JSONSCHEMA_OUT_DIR)/web_platform_dx__web_features/types.go \
--package web_platform_dx__web_features \
--field-tags json

npx quicktype \
--src jsonschema/mdn_browser-compat-data/browsers.schema.json \
--src-lang schema \
Expand Down
Loading
Loading