2021-09-14 20:36:40 +02:00
|
|
|
import joi from 'joi';
|
|
|
|
import { nameType } from '../routes/util';
|
2020-02-27 21:26:18 +01:00
|
|
|
|
2021-09-14 20:36:40 +02:00
|
|
|
export const nameSchema = joi.object().keys({ name: nameType });
|
2020-02-27 21:26:18 +01:00
|
|
|
|
2021-09-14 20:36:40 +02:00
|
|
|
export const contextSchema = joi
|
2020-02-27 21:26:18 +01:00
|
|
|
.object()
|
|
|
|
.keys({
|
|
|
|
name: nameType,
|
2021-08-12 15:04:37 +02:00
|
|
|
description: joi.string().max(250).allow('').allow(null).optional(),
|
2020-02-27 21:26:18 +01:00
|
|
|
legalValues: joi
|
|
|
|
.array()
|
|
|
|
.allow(null)
|
|
|
|
.unique()
|
|
|
|
.optional()
|
2020-10-04 20:36:40 +02:00
|
|
|
.items(joi.string().max(100)),
|
2021-08-12 15:04:37 +02:00
|
|
|
stickiness: joi.boolean().optional().default(false),
|
2020-02-27 21:26:18 +01:00
|
|
|
})
|
|
|
|
.options({ allowUnknown: false, stripUnknown: true });
|