Skip to content

Commit 0c88174

Browse files
committed
[feat] Add JSONSchemas
1 parent 5910e56 commit 0c88174

2 files changed

Lines changed: 281 additions & 0 deletions

File tree

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"$id": "https://example.com/schemas/compiled.schema.json",
4+
"title": "Component Gallery compiled catalog (compiled/components.json)",
5+
"type": "object",
6+
"additionalProperties": false,
7+
"required": ["generatedAt", "schemaVersion", "categories", "components"],
8+
"properties": {
9+
"generatedAt": { "type": "string", "format": "date-time" },
10+
"schemaVersion": { "type": "integer", "const": 1 },
11+
"categories": {
12+
"type": "array",
13+
"minItems": 1,
14+
"uniqueItems": true,
15+
"items": { "type": "string" }
16+
},
17+
"components": {
18+
"type": "array",
19+
"items": {
20+
"type": "object",
21+
"additionalProperties": false,
22+
"required": [
23+
"title",
24+
"author",
25+
"socialUrl",
26+
"pipLink",
27+
"categories",
28+
"image",
29+
"gitHubUrl",
30+
"enabled",
31+
"appUrl"
32+
],
33+
"properties": {
34+
"title": { "type": "string", "minLength": 1 },
35+
"author": { "type": "string", "minLength": 1 },
36+
"pipLink": {
37+
"oneOf": [
38+
{ "type": "string", "minLength": 1 },
39+
{ "type": "null" }
40+
]
41+
},
42+
"pypi": {
43+
"oneOf": [
44+
{ "type": "string", "minLength": 1 },
45+
{ "type": "null" }
46+
]
47+
},
48+
"categories": {
49+
"type": "array",
50+
"minItems": 1,
51+
"uniqueItems": true,
52+
"items": { "type": "string" }
53+
},
54+
"image": { "type": ["string", "null"], "format": "uri" },
55+
"gitHubUrl": { "type": "string", "format": "uri" },
56+
"enabled": { "type": "boolean" },
57+
"appUrl": { "type": ["string", "null"], "format": "uri" },
58+
"socialUrl": { "type": ["string", "null"], "format": "uri" },
59+
"metrics": {
60+
"type": ["object", "null"],
61+
"additionalProperties": false,
62+
"properties": {
63+
"github": {
64+
"type": ["object", "null"],
65+
"additionalProperties": false,
66+
"properties": {
67+
"stars": { "type": ["integer", "null"], "minimum": 0 },
68+
"forks": { "type": ["integer", "null"], "minimum": 0 },
69+
"contributorsCount": {
70+
"type": ["integer", "null"],
71+
"minimum": 0
72+
},
73+
"openIssues": { "type": ["integer", "null"], "minimum": 0 },
74+
"lastPushAt": {
75+
"type": ["string", "null"],
76+
"format": "date-time"
77+
},
78+
"fetchedAt": {
79+
"type": ["string", "null"],
80+
"format": "date-time"
81+
},
82+
"isStale": { "type": ["boolean", "null"] }
83+
}
84+
},
85+
"pypi": {
86+
"type": ["object", "null"],
87+
"additionalProperties": false,
88+
"properties": {
89+
"latestVersion": {
90+
"oneOf": [
91+
{ "type": "string", "minLength": 1 },
92+
{ "type": "null" }
93+
]
94+
},
95+
"latestReleaseAt": {
96+
"type": ["string", "null"],
97+
"format": "date-time"
98+
},
99+
"fetchedAt": {
100+
"type": ["string", "null"],
101+
"format": "date-time"
102+
},
103+
"isStale": { "type": ["boolean", "null"] }
104+
}
105+
},
106+
"pypistats": {
107+
"type": ["object", "null"],
108+
"additionalProperties": false,
109+
"properties": {
110+
"lastDay": { "type": ["integer", "null"], "minimum": 0 },
111+
"lastWeek": { "type": ["integer", "null"], "minimum": 0 },
112+
"lastMonth": { "type": ["integer", "null"], "minimum": 0 },
113+
"fetchedAt": {
114+
"type": ["string", "null"],
115+
"format": "date-time"
116+
},
117+
"isStale": { "type": ["boolean", "null"] }
118+
}
119+
}
120+
}
121+
},
122+
"ranking": {
123+
"type": ["object", "null"],
124+
"additionalProperties": false,
125+
"required": ["score", "signals", "computedAt"],
126+
"properties": {
127+
"score": { "type": "number" },
128+
"computedAt": { "type": "string", "format": "date-time" },
129+
"signals": {
130+
"type": "object",
131+
"additionalProperties": false,
132+
"properties": {
133+
"starsScore": { "type": ["number", "null"] },
134+
"recencyScore": { "type": ["number", "null"] },
135+
"daysSinceUpdate": {
136+
"type": ["number", "null"],
137+
"minimum": 0
138+
},
139+
"contributorsScore": { "type": ["number", "null"] },
140+
"daysSinceGithubPush": {
141+
"type": ["number", "null"],
142+
"minimum": 0
143+
},
144+
"daysSincePypiRelease": {
145+
"type": ["number", "null"],
146+
"minimum": 0
147+
},
148+
"downloadsScore": { "type": ["number", "null"] }
149+
}
150+
}
151+
}
152+
}
153+
}
154+
}
155+
}
156+
}
157+
}
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"$id": "https://example.com/schemas/component.schema.json",
4+
"title": "Component Gallery submission (source-of-truth)",
5+
"type": "object",
6+
"additionalProperties": false,
7+
"required": ["schemaVersion", "title", "author", "links", "governance", "categories"],
8+
"properties": {
9+
"schemaVersion": {
10+
"type": "integer",
11+
"const": 1
12+
},
13+
"title": {
14+
"type": "string",
15+
"minLength": 1,
16+
"maxLength": 80
17+
},
18+
"author": {
19+
"type": "object",
20+
"additionalProperties": false,
21+
"required": ["github"],
22+
"properties": {
23+
"github": {
24+
"type": "string",
25+
"minLength": 1,
26+
"maxLength": 39,
27+
"pattern": "^[A-Za-z0-9_]+(?:-[A-Za-z0-9_]+)*$",
28+
"description": "GitHub username (no @)."
29+
},
30+
"displayName": {
31+
"type": "string",
32+
"minLength": 1,
33+
"maxLength": 80
34+
}
35+
}
36+
},
37+
"links": {
38+
"type": "object",
39+
"additionalProperties": false,
40+
"required": ["github"],
41+
"properties": {
42+
"github": {
43+
"type": "string",
44+
"format": "uri",
45+
"pattern": "^https://github\\.com/[^/]+/[^/]+/?$"
46+
},
47+
"pypi": {
48+
"type": ["string", "null"],
49+
"pattern": "^[A-Za-z0-9_.-]+$",
50+
"description": "PyPI project name (not a URL)."
51+
},
52+
"demo": {
53+
"type": ["string", "null"],
54+
"format": "uri"
55+
},
56+
"docs": {
57+
"type": ["string", "null"],
58+
"format": "uri"
59+
}
60+
}
61+
},
62+
"media": {
63+
"type": "object",
64+
"additionalProperties": false,
65+
"properties": {
66+
"image": {
67+
"type": ["string", "null"],
68+
"format": "uri"
69+
}
70+
}
71+
},
72+
"install": {
73+
"type": "object",
74+
"additionalProperties": false,
75+
"properties": {
76+
"pip": {
77+
"type": ["string", "null"],
78+
"minLength": 1,
79+
"maxLength": 200
80+
}
81+
}
82+
},
83+
"governance": {
84+
"type": "object",
85+
"additionalProperties": false,
86+
"required": ["enabled"],
87+
"properties": {
88+
"enabled": {
89+
"type": "boolean"
90+
},
91+
"notes": {
92+
"type": ["string", "null"],
93+
"maxLength": 500
94+
}
95+
}
96+
},
97+
"categories": {
98+
"type": "array",
99+
"minItems": 1,
100+
"uniqueItems": true,
101+
"items": {
102+
"type": "string",
103+
"enum": [
104+
"LLMs",
105+
"Widgets",
106+
"Charts",
107+
"Authentication",
108+
"Connections",
109+
"Images & video",
110+
"Audio",
111+
"Text",
112+
"Maps",
113+
"Dataframes",
114+
"Graphs",
115+
"Molecules & genes",
116+
"Code editors",
117+
"Page navigation",
118+
"Developer tools",
119+
"Integrations"
120+
]
121+
}
122+
}
123+
}
124+
}

0 commit comments

Comments
 (0)