Skip to content

Commit 91e2fa0

Browse files
committed
[feat] Add JSONSchemas
1 parent c8aa271 commit 91e2fa0

2 files changed

Lines changed: 293 additions & 0 deletions

File tree

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

0 commit comments

Comments
 (0)