forked from bazelbuild/bazel-central-registry
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: introduce JSON schema for metadata format (bazelbuild#1149)
This allows for nice developer ergonomics in the editor, which can now provide autocomplete and error highlighting in metadata.json files, if a $schema property is added. It also adds a layer of validation for things like required fields in these json documents. Fixes bazelbuild#1148
- Loading branch information
Showing
8 changed files
with
265 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
tools/__pycache__ | ||
tools/node_modules | ||
/bazel-* |
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,21 @@ | ||
load("@npm//tools:ajv-cli/package_json.bzl", ajv = "bin") | ||
|
||
_METADATA_FILES = glob(["modules/*/metadata.json"]) | ||
|
||
[ | ||
ajv.ajv_test( | ||
name = "test_metadata." + s.removesuffix("/metadata.json"), | ||
args = [ | ||
"validate", | ||
"-s", | ||
"$(execpath metadata.schema.json)", | ||
"-d", | ||
"$(execpath %s)" % s, | ||
], | ||
data = [ | ||
s, | ||
"metadata.schema.json", | ||
], | ||
) | ||
for s in _METADATA_FILES | ||
] |
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,50 @@ | ||
{ | ||
"$id": "https://github.com/bazelbuild/bazel-central-registry/modules/metadata.schema.json", | ||
"title": "Metadata for a Bazel module", | ||
"type": "object", | ||
"properties": { | ||
"$schema": { "type": "string" }, | ||
"homepage": {"type": "string"}, | ||
"maintainers": { | ||
"description": "Individuals who can be notified when the module requires human attention", | ||
"type": "array", | ||
"items": { | ||
"type": "object", | ||
"properties": { | ||
"github": { | ||
"type": "string", | ||
"description": "maintainer's github username" | ||
}, | ||
"email": { | ||
"type": "string", | ||
"description": "maintainer's email address" | ||
}, | ||
"name": { | ||
"type": "string", | ||
"description": "maintainer's name" | ||
} | ||
} | ||
} | ||
}, | ||
"repository": { | ||
"type": "array", | ||
"items": { | ||
"description": "repository, typically in the form github:[github org]/[github repo]", | ||
"type": "string" | ||
} | ||
}, | ||
"versions": { | ||
"type": "array", | ||
"items": { | ||
"description": "semver version", | ||
"type": "string" | ||
} | ||
}, | ||
"yanked_versions": { | ||
"type": "object", | ||
"additionalProperties": true | ||
} | ||
}, | ||
"additionalProperties": false, | ||
"required": ["homepage", "versions"] | ||
} |
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 |
---|---|---|
|
@@ -18,5 +18,5 @@ | |
"versions": [ | ||
"0.10.0" | ||
], | ||
"yanked_versions": [] | ||
"yanked_versions": {} | ||
} |
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,6 @@ | ||
{ | ||
"private": true, | ||
"devDependencies": { | ||
"ajv-cli": "*" | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.