/
schema.js
378 lines (377 loc) · 12 KB
/
schema.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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
const regenerate = require('regenerate');
module.exports = {
// $id: 'https://github.com/scripting/Scripting-News/tree/master/rss-in-json', // @TODO get a URI for this schema
$schema: 'http://json-schema.org/schema#',
title: 'RSS-in-JSON',
type: 'object',
properties: {
rss: {
type: 'object',
properties: {
version: {
type: 'string',
const: '2.0',
description: 'the version of RSS the feed uses'
},
channel: {
type: 'object',
properties: {
title: {
type: 'string',
description: 'the name of the channel'
},
link: {
type: 'string',
format: 'uri',
description: 'the URL to the HTML website corresponding to the channel'
},
description: {
type: 'string',
description: 'phrase or sentence describing the channel'
},
language: {
type: 'string',
pattern: '^[A-Za-z]+(?:-[A-Za-z]+)?$',
description: 'the language the channel is written in'
},
copyright: {
type: 'string',
description: 'copyright notice for content in the channel'
},
managingEditor: {
type: 'string',
description: 'email address for person responsible for editorial content'
},
webMaster: {
type: 'string',
description: 'email address for person responsible for technical issues relating to channel'
},
pubDate: {
type: 'string',
description: 'the publication date for the content in the channel, in RFC 822 format'
},
lastBuildDate: {
type: 'string',
description: 'the last time the content of the channel changed, in RFC 822 format'
},
category: {
type: 'array',
description: 'one or more categories that the channel belongs to',
items: {
$ref: '#/definitions/category'
}
},
generator: {
type: 'string',
description: 'a string indicating the program used to generate the channel'
},
docs: {
type: 'string',
format: 'uri',
description: 'a URL that points to the documentation for the format used in the RSS file'
},
cloud: {
type: 'object',
description: 'allows processes to register with a cloud to be notified of updates to the channel, implementing a lightweight publish-subscribe protocol for RSS feeds',
properties: {
domain: {
oneOf: [
{
type: 'string',
format: 'hostname',
description: 'the domain name of the cloud'
},
{
type: 'string',
format: 'ipv4',
description: 'the IP address of the cloud'
}
]
},
port: {
type: 'integer',
description: 'the TCP port that the cloud is running on'
},
path: {
type: 'string',
description: 'the location of its responder'
},
registerProcedure: {
type: 'string',
description: 'the name of the procedure to call to request notification'
},
protocol: {
type: 'string',
enum: [ 'xml-rpc', 'soap', 'http-post' ],
description: 'which protocol to be used'
}
},
required: [ 'domain', 'port', 'path', 'registerProcedure', 'protocol' ]
},
ttl: {
type: 'number',
description: 'ttl stands for time to live; a number of minutes that indicates how long a channel can be cached before refreshing from the source'
},
image: {
description: 'a GIF, JPEG or PNG image that can be displayed with the channel',
$ref: '#/definitions/image'
},
rating: {
type: 'string',
description: 'the PICS rating for the channel'
},
textInput: {
type: 'object',
description: 'a text input box that can be displayed with the channel',
properties: {
title: {
type: 'string',
description: 'the label of the Submit button in the text input area'
},
description: {
type: 'string',
description: 'explains the text input area'
},
name: {
type: 'string',
description: 'the name of the text object in the text input area'
},
link: {
type: 'string',
format: 'uri',
description: 'the URL of the CGI script that processes text input requests'
}
},
required: [ 'title', 'description', 'name', 'link' ]
},
skipHours: {
type: 'object',
properties: {
hour: {
type: 'array',
maxItems: 24,
uniqueItems: true,
description: 'each hour is a number between 0 and 23, representing a time in GMT, when aggregators, if they support the feature, may not read the channel',
items: {
type: 'integer',
minimum: 0,
maximum: 23
}
}
}
},
skipDays: {
type: 'object',
properties: {
day: {
type: 'array',
maxItems: 7,
uniqueItems: true,
description: 'aggregators, if they support the feature, may not read the channel during the listed days',
items: {
type: 'string',
enum: [ 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday' ]
}
}
}
},
item: {
type: 'array',
items: {
$ref: '#/definitions/item'
}
}
},
required: [ 'title', 'link', 'description' ]
}
},
patternProperties: {
[`^xmlns:${
regenerate()
.addRange('A', 'Z')
.addRange('a', 'z')
.add('_')
.addRange(0xC0, 0xD6)
.addRange(0xD8, 0xF6)
.addRange(0xF8, 0x02FF)
.addRange(0x0370, 0x037D)
.addRange(0x037F, 0x1FFF)
.addRange(0x200C, 0x200D)
.addRange(0x2070, 0x218F)
.addRange(0x2C00, 0x2FEF)
.addRange(0x3001, 0xD7FF)
.addRange(0xF900, 0xFDCF)
.addRange(0xFDF0, 0xFFFD)
.addRange(0x10000, 0xEFFFF)
.add('-')
.add('.')
.addRange(0, 9)
.add(0xB7)
.addRange(0x0300, 0x036F)
.addRange(0x203F, 0x2040)
.toString()
}+$`]: {
type: 'string',
format: 'uri'
}
},
additionalProperties: false,
required: [ 'version', 'channel' ]
}
},
required: [ 'rss' ],
definitions: {
category: {
oneOf: [
{
type: 'string'
},
{
type: 'object',
properties: {
domain: {
type: 'string',
description: 'a string that identifies a categorization taxonomy'
},
'#value': {
type: 'string'
}
},
required: [ 'domain', '#value' ]
}
]
},
image: {
type: 'object',
properties: {
url: {
type: 'string',
format: 'uri',
description: 'the URL of a GIF, JPEG or PNG image that represents the channel'
},
title: {
type: 'string',
description: 'describes the image and is used in the ALT attribute of the HTML <img> tag when the channel is rendered in HTML'
},
link: {
type: 'string',
format: 'uri',
description: 'is the URL of the site, and when the channel is rendered, the image is a link to the site'
},
width: {
type: 'integer',
maximum: 144
},
height: {
type: 'integer',
maximum: 400
},
description: {
type: 'string',
description: 'text that is included in the TITLE attribute of the link formed around the image in the HTML rendering'
}
},
required: [ 'url', 'title', 'link' ]
},
item: {
type: 'object',
properties: {
title: {
type: 'string',
description: 'the title of the item'
},
link: {
type: 'string',
format: 'uri',
description: 'the URL of the item'
},
description: {
type: 'string',
description: 'the item synopsis'
},
author: {
type: 'string',
description: 'email address of the author of the item'
},
category: {
type: 'array',
description: 'includes the item in one or more categories',
items: {
$ref: '#/definitions/category'
}
},
comments: {
type: 'string',
format: 'uri',
description: 'URL of a page for comments relating to the item'
},
enclosure: {
type: 'object',
description: 'describes a media object that is attached to the item',
properties: {
url: {
type: 'string',
format: 'uri',
description: 'where the enclosure is located'
},
length: {
type: 'integer',
description: 'how big it is in bytes'
},
type: {
type: 'string',
description: 'a standard MIME type'
}
},
required: [ 'url', 'length', 'type' ]
},
guid: {
oneOf: [
{
type: 'string',
description: 'a string that uniquely identifies the item'
},
{
type: 'object',
properties: {
isPermalink: {
type: 'boolean',
description: 'whether the reader may assume that the guid is a permalink to the item'
},
'#value': {
type: 'string',
description: 'a string that uniquely identifies the item'
}
},
required: [ '#value' ]
}
]
},
pubDate: {
type: 'string',
description: 'when the item was published, in RFC 822 format'
},
source: {
type: 'object',
properties: {
url: {
type: 'string',
format: 'uri',
description: 'link to the XMLization of the source'
},
'#value': {
type: 'string',
description: 'the name of the RSS channel that the item came from, derived from its <title>'
}
},
required: [ 'url', '#value' ]
}
},
anyOf: [
{ required: [ 'title' ] },
{ required: [ 'link' ] },
{ required: [ 'description' ] }
]
}
}
};