1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-10-18 20:09:08 +02:00
unleash.unleash/src/lib/services/context-schema.js

24 lines
650 B
JavaScript
Raw Normal View History

'use strict';
2020-07-31 22:15:09 +02:00
const joi = require('joi');
const { nameType } = require('../routes/admin-api/util');
const nameSchema = joi.object().keys({ name: nameType });
const contextSchema = joi
.object()
.keys({
name: nameType,
description: joi.string().max(250).allow('').allow(null).optional(),
legalValues: joi
.array()
.allow(null)
.unique()
.optional()
.items(joi.string().max(100)),
stickiness: joi.boolean().optional().default(false),
})
.options({ allowUnknown: false, stripUnknown: true });
module.exports = { contextSchema, nameSchema };