1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-10-18 20:09:08 +02:00
unleash.unleash/lib/routes/admin-api/context-schema.js
Ivar Conradi Østhus 4f1d4df4b8
feat: allow stickiness on context-fields (#713)
* feat: allow stickiness on context-fields

* chore: docs for this feature

* fix: write a small e2e test

* fix: add stickiness to variants
2021-02-11 17:59:16 +01:00

32 lines
736 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)),
stickiness: joi
.boolean()
.optional()
.default(false),
})
.options({ allowUnknown: false, stripUnknown: true });
module.exports = { contextSchema, nameSchema };