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
Ivar Conradi Østhus 7a410508cb
feat: api supports context fields (#564)
* feat: api supports context fields

* fix: typo for cotnext group in event-differ
2020-02-27 21:26:18 +01:00

27 lines
611 B
JavaScript

'use strict';
const joi = require('@hapi/joi');
const { nameType } = require('./util');
const nameSchema = joi.object().keys({ name: nameType });
const contextSchema = joi
.object()
.keys({
name: nameType,
description: joi
.string()
.allow('')
.allow(null)
.optional(),
legalValues: joi
.array()
.allow(null)
.unique()
.optional()
.items(joi.string()),
})
.options({ allowUnknown: false, stripUnknown: true });
module.exports = { contextSchema, nameSchema };