Skip to content

Commit 57786d7

Browse files
Add schema stuff
1 parent 616b45a commit 57786d7

File tree

4 files changed

+122
-0
lines changed

4 files changed

+122
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"type": "object",
4+
"title": "Collect",
5+
"description": "Subscription to collect page content data",
6+
"properties": {},
7+
"additionalProperties": false
8+
}
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"type": "object",
4+
"title": "CollectionResult",
5+
"description": "Result of page content collection, either success or error",
6+
"oneOf": [
7+
{
8+
"type": "object",
9+
"title": "Collection Success",
10+
"required": ["success", "data"],
11+
"properties": {
12+
"success": {
13+
"const": true
14+
},
15+
"data": {
16+
"type": "object",
17+
"description": "Collected page data",
18+
"required": ["favicon", "title", "content", "truncated", "timestamp", "url"],
19+
"properties": {
20+
"favicon": {
21+
"type": "array",
22+
"description": "List of favicon URLs",
23+
"items": {
24+
"type": "string"
25+
}
26+
},
27+
"title": {
28+
"type": ["string", "null"],
29+
"description": "Page title"
30+
},
31+
"metaDescription": {
32+
"type": ["string", "null"],
33+
"description": "Page meta description"
34+
},
35+
"content": {
36+
"type": "string",
37+
"description": "Main page content in markdown format"
38+
},
39+
"truncated": {
40+
"type": "boolean",
41+
"description": "Whether content was truncated due to size limits"
42+
},
43+
"headings": {
44+
"type": "array",
45+
"description": "List of page headings",
46+
"items": {
47+
"type": "string"
48+
}
49+
},
50+
"links": {
51+
"type": "array",
52+
"description": "List of page links",
53+
"items": {
54+
"type": "string"
55+
}
56+
},
57+
"images": {
58+
"type": "array",
59+
"description": "List of image URLs",
60+
"items": {
61+
"type": "string"
62+
}
63+
},
64+
"timestamp": {
65+
"type": "number",
66+
"description": "Unix timestamp when data was collected"
67+
},
68+
"url": {
69+
"type": "string",
70+
"description": "Page URL"
71+
}
72+
}
73+
}
74+
}
75+
},
76+
{
77+
"type": "object",
78+
"title": "Collection Error",
79+
"required": ["success", "error"],
80+
"properties": {
81+
"success": {
82+
"const": false
83+
},
84+
"error": {
85+
"type": "string",
86+
"description": "Error message describing what went wrong"
87+
}
88+
}
89+
}
90+
]
91+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"type": "object",
4+
"title": "GetActiveSelectionLanguage",
5+
"description": "Subscription to get the active selection's language",
6+
"properties": {},
7+
"additionalProperties": false
8+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"type": "object",
4+
"title": "GetActiveSelectionLanguageResult",
5+
"description": "Result of getting the active selection's language as BCP 47 language tag",
6+
"required": ["activeSelectionLanguage"],
7+
"properties": {
8+
"activeSelectionLanguage": {
9+
"type": ["string", "null"],
10+
"description": "BCP 47 language tag of the active selection (e.g., 'en', 'en-US', 'fr-FR') or null if no language detected",
11+
"pattern": "^(?:en-GB-oed|i-ami|i-bnn|i-default|i-enochian|i-hak|i-klingon|i-lux|i-mingo|i-navajo|i-pwn|i-tao|i-tay|i-tsu|sgn-BE-FR|sgn-BE-NL|sgn-CH-DE|art-lojban|cel-gaulish|no-bok|no-nyn|zh-guoyu|zh-hakka|zh-min|zh-min-nan|zh-xiang|(?:(?:[A-Za-z]{2,3}(?:-[A-Za-z]{3}(?:-[A-Za-z]{3}){0,2})?|[A-Za-z]{4,8})(?:-[A-Za-z]{4})?(?:-[A-Za-z]{2}|[0-9]{3})?(?:(?:-(?:[0-9A-Za-z]{5,8}|[0-9][0-9A-Za-z]{3}))*)(?:(?:-(?:[0-9A-WY-Za-wy-z](?:-[0-9A-Za-z]{2,8})+))*)(?:-(?:x(?:-[0-9A-Za-z]{1,8})+))?)|(?:x(?:-[0-9A-Za-z]{1,8})+))$",
12+
"examples": ["en", "en-US", "fr-FR", "zh-CN", null]
13+
}
14+
}
15+
}

0 commit comments

Comments
 (0)