mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-22 19:07:54 +01:00
28 lines
659 B
JavaScript
28 lines
659 B
JavaScript
'use strict';
|
|
|
|
const joi = require('joi');
|
|
const { nameType } = require('./util');
|
|
|
|
const nameSchema = joi.object().keys({ name: nameType });
|
|
|
|
const strategiesSchema = joi.object().keys({
|
|
name: nameType,
|
|
parameters: joi.object(),
|
|
});
|
|
|
|
const featureShema = joi
|
|
.object()
|
|
.keys({
|
|
name: nameType,
|
|
enabled: joi.boolean().default(false),
|
|
description: joi.string(),
|
|
strategies: joi
|
|
.array()
|
|
.required()
|
|
.min(1)
|
|
.items(strategiesSchema),
|
|
})
|
|
.options({ allowUnknown: false, stripUnknown: true });
|
|
|
|
module.exports = { featureShema, strategiesSchema, nameSchema };
|