mirror of
https://github.com/Unleash/unleash.git
synced 2024-10-18 20:09:08 +02:00
4f1d4df4b8
* feat: allow stickiness on context-fields * chore: docs for this feature * fix: write a small e2e test * fix: add stickiness to variants
32 lines
736 B
JavaScript
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 };
|