-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema.js
More file actions
37 lines (32 loc) · 898 Bytes
/
schema.js
File metadata and controls
37 lines (32 loc) · 898 Bytes
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
'use strict';
const Joi = require('joi');
const arrayObj = Joi.object().keys({
url: Joi.string(),
filename: Joi.string().required(),
layerId: Joi.string().required(),
layerName: Joi.string(),
agencyId: Joi.string(),
agencyName: Joi.string()
}).requiredKeys('filename', 'layerId');
/** Schema Configuration
datapath: string (required)
feeds: array of objects ... see above (required)
example:
"transit": {
"datapath": "/data/transit",
"feeds": [
{
"layerId": "stops",
"url": "http://developer.trimet.org/schedule/gtfs.zip",
"filename": "TRIMET-stops.txt",
"agencyId": "TRIMET",
"agencyName": "TriMet"
}
]
},
...
*/
module.exports = Joi.object().keys({
datapath: Joi.string(),
feeds: Joi.array().min(1).items(arrayObj),
}).requiredKeys('datapath', 'feeds');