Skip to content

Commit aa28e42

Browse files
committed
Generate orgs.json with org metadata alongside index.json
- compile.py now outputs orgs.json keyed by namespace slug, containing org name, description, url, maintainers, and register slug list - Optional description field added to org schema and OGC entry - compile workflow stages orgs.json to _site/ for GitHub Pages - orgs.json added to .gitignore
1 parent e7e770d commit aa28e42

4 files changed

Lines changed: 21 additions & 10 deletions

File tree

.github/scripts/compile.py

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env python3
2-
"""Compile registers/*/registers.yaml into a flat index.json."""
2+
"""Compile registers/*/registers.yaml into index.json and orgs.json."""
33

44
import argparse
55
import json
@@ -20,6 +20,7 @@
2020
"additionalProperties": False,
2121
"properties": {
2222
"name": {"type": "string", "minLength": 1},
23+
"description": {"type": "string", "minLength": 1},
2324
"url": {
2425
"type": "string",
2526
"pattern": r"^https?://",
@@ -56,8 +57,9 @@
5657
_validator = jsonschema.Draft7Validator(REGISTERS_SCHEMA)
5758

5859

59-
def compile_index(registers_root: Path) -> tuple[dict, list[str]]:
60+
def compile(registers_root: Path) -> tuple[dict, dict, list[str]]:
6061
index = {}
62+
orgs = {}
6163
errors = []
6264

6365
for registers_file in sorted(registers_root.glob("*/registers.yaml")):
@@ -82,15 +84,20 @@ def compile_index(registers_root: Path) -> tuple[dict, list[str]]:
8284
continue
8385
index[key] = url
8486

85-
return index, errors
87+
orgs[org] = {
88+
**data["org"],
89+
"registers": list(data["registers"].keys()),
90+
}
91+
92+
return index, orgs, errors
8693

8794

8895
def main():
8996
parser = argparse.ArgumentParser(description=__doc__)
9097
parser.add_argument(
9198
"--validate",
9299
action="store_true",
93-
help="Validate only — do not write index.json",
100+
help="Validate only — do not write output files",
94101
)
95102
args = parser.parse_args()
96103

@@ -100,23 +107,25 @@ def main():
100107
print(f"ERROR: registers directory not found at {root}", file=sys.stderr)
101108
sys.exit(1)
102109

103-
index, errors = compile_index(root)
110+
index, orgs, errors = compile(root)
104111

105112
if errors:
106113
for e in errors:
107114
print(f"ERROR: {e}", file=sys.stderr)
108115
sys.exit(1)
109116

110117
if args.validate:
111-
print(f"OK: {len(index)} entries validated")
118+
print(f"OK: {len(index)} register entries, {len(orgs)} orgs validated")
112119
return
113120

114121
if "@ogc/main" in index:
115122
index = {"default": index["@ogc/main"], **index}
116123

117-
out = cwd / "index.json"
118-
out.write_text(json.dumps(index, indent=2) + "\n")
119-
print(f"Wrote {len(index)} entries to {out}")
124+
(cwd / "index.json").write_text(json.dumps(index, indent=2) + "\n")
125+
print(f"Wrote {len(index)} entries to index.json")
126+
127+
(cwd / "orgs.json").write_text(json.dumps(orgs, indent=2) + "\n")
128+
print(f"Wrote {len(orgs)} orgs to orgs.json")
120129

121130

122131
if __name__ == "__main__":

.github/workflows/compile.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
- name: Stage Pages output
3636
run: |
3737
mkdir _site
38-
cp index.json index.html _site/
38+
cp index.json orgs.json index.html _site/
3939
4040
- uses: actions/upload-pages-artifact@v3
4141
with:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
index.json
2+
orgs.json
23
_site/

registers/ogc/registers.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
org:
22
name: Open Geospatial Consortium
3+
description: The Open Geospatial Consortium (OGC) is an international consortium of companies, government agencies, research organizations, and universities focused on developing publicly available geospatial standards
34
url: https://www.ogc.org
45
maintainers:
56
- github: avillar

0 commit comments

Comments
 (0)