forked from pelias/whosonfirst
-
Notifications
You must be signed in to change notification settings - Fork 1
/
schema.js
37 lines (35 loc) · 1.52 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
const Joi = require('@hapi/joi');
// Schema Configuration
// required:
// * imports.whosonfirst.datapath (string)
//
// optional:
// * imports.whosonfirst.countryCode (string OR array[string]) (default: [])
// * imports.whosonfirst.importPostalcodes (boolean) (default: false)
// * imports.whosonfirst.importConstituencies (boolean) (default: false)
// * imports.whosonfirst.importIntersections (boolean) (default: false)
// * imports.whosonfirst.importPlace (integer OR array[integer]) (default: none)
// * imports.whosonfirst.sqlite (boolean) (default: true)
module.exports = Joi.object().keys({
imports: Joi.object().required().keys({
whosonfirst: Joi.object().required().keys({
countryCode: Joi.alternatives().try(
Joi.string(),
Joi.array().items(Joi.string()).default([])
).default([]),
dataHost: Joi.string(),
datapath: Joi.string().required(),
polygons: Joi.boolean().default(false).truthy('yes').falsy('no'),
simplifyPolygons: Joi.boolean().default(false).truthy('yes').falsy('no'),
simplificationRate: Joi.number().default(0.0003),
importPlace: [
Joi.number().integer(),
Joi.array().items(Joi.number().integer())
],
importPostalcodes: Joi.boolean().default(false).truthy('yes').falsy('no'),
importConstituencies: Joi.boolean().default(false).truthy('yes').falsy('no'),
maxDownloads: Joi.number().integer(),
sqlite: Joi.boolean().default(true).truthy('yes').falsy('no')
}).unknown(false)
}).unknown(true)
}).unknown(true);