mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-11 00:08:30 +01:00
31 lines
716 B
JavaScript
31 lines
716 B
JavaScript
'use strict';
|
|
|
|
const joi = require('joi');
|
|
|
|
const strategiesSchema = joi.object().keys({
|
|
name: joi
|
|
.string()
|
|
.regex(/^[a-zA-Z0-9\\.\\-]{3,100}$/)
|
|
.required(),
|
|
parameters: joi.object(),
|
|
});
|
|
|
|
const featureShema = joi
|
|
.object()
|
|
.keys({
|
|
name: joi
|
|
.string()
|
|
.regex(/^[a-zA-Z0-9\\.\\-]{3,100}$/)
|
|
.required(),
|
|
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 };
|