1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-28 00:06:53 +01:00
unleash.unleash/lib/routes/admin-api/context-schema.js
2020-10-04 20:36:40 +02:00

28 lines
636 B
JavaScript

'use strict';
const joi = require('joi');
const { nameType } = require('./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)),
})
.options({ allowUnknown: false, stripUnknown: true });
module.exports = { contextSchema, nameSchema };