forked from HSLdevcom/pelias-api
-
Notifications
You must be signed in to change notification settings - Fork 2
/
schema.js
34 lines (31 loc) · 1.03 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
'use strict';
const Joi = require('joi');
// Schema Configuration
// required:
// * api.version (string)
// * api.indexName (string)
// * api.host (string)
// * esclient (object - positive integer requestTimeout)
//
// optional:
// * api.accessLog (string)
// * api.relativeScores (boolean)
// * api.legacyUrl (string)
// * api.localization (flipNumberAndStreetCountries is array of 3 character strings)
module.exports = Joi.object().keys({
api: Joi.object().keys({
version: Joi.string(),
indexName: Joi.string(),
host: Joi.string(),
legacyUrl: Joi.string(),
accessLog: Joi.string(),
relativeScores: Joi.boolean(),
requestRetries: Joi.number().integer().min(0),
localization: Joi.object().keys({
flipNumberAndStreetCountries: Joi.array().items(Joi.string().regex(/^[A-Z]{3}$/))
}).unknown(true)
}).requiredKeys('version', 'indexName', 'host').unknown(true),
esclient: Joi.object().keys({
requestTimeout: Joi.number().integer().min(0)
}).unknown(true)
}).requiredKeys('api', 'esclient').unknown(true);