-
Notifications
You must be signed in to change notification settings - Fork 15
/
draft-format.js
189 lines (189 loc) · 5.8 KB
/
draft-format.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
module.exports = {
"$schema": "http://json-schema.org/draft-06/schema#",
"id": "http://json-schema.org/draft-06/schema#",
"type": "object",
"properties": {
"sourceMap": {
"type": "array",
"minItems": 1,
"items": { "$ref": "#/definitions/sourceMap" }
},
"image": {
"type": "array",
"items": {
"format": "uri"
}
},
"location": {
"description": "Geo tag of the post. Status: WIP. (Subject to change)",
"$ref": "#/definitions/GeoCoordinates",
},
"author_name": {
"description": "Author display name, might be different from username/author of post. For example this should be used when a different author created the post",
"type": "string",
"maxLength": 128
},
"category": {
"description": "Category of the post. Can be plaintext, or a cryptographic reference. (Subject to change)",
"type": "string",
"maxLength": 128
},
"tags": {
"type": "array",
"minItems": 1,
"items": { "type": "string" }
},
"hidden": {
"description": "Disables display of post.",
"type": "boolean",
},
"title": {
"type": "string", "maxLength": 128
},
"description": {
"$ref": "#/definitions/description"
},
"created": {
"type": "string",
"format": "date"
},
"last_update": {
"type": "string",
"format": "date"
},
"lang": {
"description": "ISO 3166-1 alpha-2 language",
"type": "string",
"maxLength": 2
},
"attachments": {
"description": "Work in progress",
"type": "array",
"items": { "type": "string" }
},
"mentions": {
"description": "Work in progress",
"type": "array",
"items": { "type": "string" }
},
"refs": {
"description": "Post refs, meant for identifying duplicate posts and/or linking to mirrored content across networks. The first item in the array should be the primary ref.",
"type": "array",
"minItems": 1,
"items": { "type": "string" }
},
"ipfsLinks": {
"type": "array",
"items": {
"$ref": "#/definitions/ipfsLink"
}
},
"preferredGateways": {
"type": "array",
"items": {"type": "string"}
},
"filesize": { "type": "number" },
"video": {
"type": "object",
"properties": {
"duration": { "type": "number" },
"first_upload": { "type": "boolean" },
"license": { "type": "string" },
"extensions": {
"description": "Addition tags related to implementation specific metatags. (Subject to change) ",
"type": "array",
"items": {"type": "string"}
}
}
}
},
"definitions": {
"positiveInteger": {
"type": "integer",
"minimum": 1
},
"sourceMap": {
"type": "object",
"description": "sourceMap, used for videos, images and more!",
"required": ["type", "url"],
"properties": {
"id": {
"type": "string",
"maxLength": 12
},
"type": {
"$ref": "#/definitions/sourceMapType"
},
"url": {
"format": "uri"
},
"mimeType": {
"type": "string",
"maxLength": 50
},
"width": {
"$ref": "#/definitions/positiveInteger"
},
"height": {
"$ref": "#/definitions/positiveInteger"
},
"size": {
"$ref": "#/definitions/positiveInteger"
}
}
},
"sourceMapType": {
"enum": ["video", "thumbnail", "body"]
},
"ipfsLink": {
"type": "string",
"pattern": "Qm[1-9A-HJ-NP-Za-km-z]{44,}|b[A-Za-z2-7]{58,}|B[A-Z2-7]{58,}|z[1-9A-HJ-NP-Za-km-z]{48,}|F[0-9A-F]{50,}"
},
"description": {
"type": "object",
"description": "",
"oneOf": [
{
"required": [
"url"
]
},
{
"required": [
"value"
]
}],
"properties": {
"url": { "$ref": "#/definitions/ipfsLink" },
"value": {
"type": "string",
"maxLength": 8000
},
"format": {
"enum": ["markdown", "html", "text"]
}
}
},
"GeoCoordinates": {
"type": "object",
"required": ["latitude", "longitude"],
"properties": {
"latitude": {
"type": "number",
"minimum": -90,
"maximum": 90
},
"longitude": {
"type": "number",
"minimum": -180,
"maximum": 180
}
}
}
},
"dependencies": {
"exclusiveMinimum": "minimum",
"exclusiveMaximum": "maximum",
},
"default": {}
}