2018-12-01 12:03:47 +01:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const joi = require('joi');
|
2018-12-12 10:09:38 +01:00
|
|
|
const { nameType } = require('./util');
|
|
|
|
|
|
|
|
const nameSchema = joi.object().keys({ name: nameType });
|
2018-12-01 12:03:47 +01:00
|
|
|
|
|
|
|
const strategiesSchema = joi.object().keys({
|
2018-12-12 10:09:38 +01:00
|
|
|
name: nameType,
|
2018-12-01 12:03:47 +01:00
|
|
|
parameters: joi.object(),
|
|
|
|
});
|
|
|
|
|
|
|
|
const featureShema = joi
|
|
|
|
.object()
|
|
|
|
.keys({
|
2018-12-12 10:09:38 +01:00
|
|
|
name: nameType,
|
2018-12-01 12:03:47 +01:00
|
|
|
enabled: joi.boolean().default(false),
|
|
|
|
description: joi.string(),
|
|
|
|
strategies: joi
|
|
|
|
.array()
|
|
|
|
.required()
|
|
|
|
.min(1)
|
|
|
|
.items(strategiesSchema),
|
|
|
|
})
|
|
|
|
.options({ allowUnknown: false, stripUnknown: true });
|
|
|
|
|
2018-12-12 10:09:38 +01:00
|
|
|
module.exports = { featureShema, strategiesSchema, nameSchema };
|