2020-02-27 21:26:18 +01:00
|
|
|
'use strict';
|
|
|
|
|
2020-07-31 22:15:09 +02:00
|
|
|
const joi = require('joi');
|
2020-02-27 21:26:18 +01:00
|
|
|
const { nameType } = require('./util');
|
|
|
|
|
|
|
|
const nameSchema = joi.object().keys({ name: nameType });
|
|
|
|
|
|
|
|
const contextSchema = joi
|
|
|
|
.object()
|
|
|
|
.keys({
|
|
|
|
name: nameType,
|
|
|
|
description: joi
|
|
|
|
.string()
|
2020-10-04 20:36:40 +02:00
|
|
|
.max(250)
|
2020-02-27 21:26:18 +01:00
|
|
|
.allow('')
|
|
|
|
.allow(null)
|
|
|
|
.optional(),
|
|
|
|
legalValues: joi
|
|
|
|
.array()
|
|
|
|
.allow(null)
|
|
|
|
.unique()
|
|
|
|
.optional()
|
2020-10-04 20:36:40 +02:00
|
|
|
.items(joi.string().max(100)),
|
2020-02-27 21:26:18 +01:00
|
|
|
})
|
|
|
|
.options({ allowUnknown: false, stripUnknown: true });
|
|
|
|
|
|
|
|
module.exports = { contextSchema, nameSchema };
|