Skip to content
Merged
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 components/registry/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ Your JSON must conform to [`components/registry/schemas/component.schema.json`](

The validator enforces a few “lint” rules to keep the registry stable:

- **JSON-only directory**: every file in `components/registry/components/` must end with `.json` (placeholder files like `.gitkeep` will fail CI).
Comment thread
sfc-gh-bnisco marked this conversation as resolved.
- **Unique repo**: `links.github` must be unique across all submissions. If the same repo was already submitted, CI will fail.
- **HTTPS only**: all URLs must be `https://` and must not use `javascript:`, `data:`, or `file:` schemes.
- **Stable images** (`media.image`): must be a stable `https://` URL.
Expand Down
Empty file.
15 changes: 15 additions & 0 deletions components/registry/scripts/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,21 @@ def validate_components(repo_root: Path) -> list[ValidationIssue]:
validator = _get_validator(schema_path)

issues: list[ValidationIssue] = []
for file_path in sorted(components_dir.iterdir()):
if not file_path.is_file():
continue
if file_path.suffix != ".json":
issues.append(
ValidationIssue(
file=file_path,
schema=schema_path,
message=(
"Invalid file extension in components directory. "
"Source component files must end with `.json`."
),
json_path=None,
)
)
Comment thread
sfc-gh-bnisco marked this conversation as resolved.
for json_file in sorted(components_dir.glob("*.json")):
Comment thread
sfc-gh-bnisco marked this conversation as resolved.
issues.extend(_validate_one(json_file, schema_path, validator))
return issues
Expand Down