Remove instance name as a required screen setting and add new screen properties as optional validation

This commit is contained in:
Andrew Kingston 2022-05-11 08:46:13 +01:00
parent 7ea59a521d
commit 91c4f85f81
2 changed files with 3 additions and 1 deletions

View File

@ -9,6 +9,7 @@ const Joi = require("joi")
const OPTIONAL_STRING = Joi.string().optional().allow(null).allow("") const OPTIONAL_STRING = Joi.string().optional().allow(null).allow("")
const OPTIONAL_NUMBER = Joi.number().optional().allow(null) const OPTIONAL_NUMBER = Joi.number().optional().allow(null)
const OPTIONAL_BOOLEAN = Joi.boolean().optional().allow(null)
exports.tableValidator = () => { exports.tableValidator = () => {
// prettier-ignore // prettier-ignore
@ -159,15 +160,16 @@ exports.screenValidator = () => {
// prettier-ignore // prettier-ignore
return joiValidator.body(Joi.object({ return joiValidator.body(Joi.object({
name: Joi.string().required(), name: Joi.string().required(),
showNavigation: OPTIONAL_BOOLEAN,
routing: Joi.object({ routing: Joi.object({
route: Joi.string().required(), route: Joi.string().required(),
roleId: Joi.string().required().allow(""), roleId: Joi.string().required().allow(""),
homeScreen: OPTIONAL_BOOLEAN,
}).required().unknown(true), }).required().unknown(true),
props: Joi.object({ props: Joi.object({
_id: Joi.string().required(), _id: Joi.string().required(),
_component: Joi.string().required(), _component: Joi.string().required(),
_children: Joi.array().required(), _children: Joi.array().required(),
_instanceName: Joi.string().required(),
_styles: Joi.object().required(), _styles: Joi.object().required(),
type: OPTIONAL_STRING, type: OPTIONAL_STRING,
table: OPTIONAL_STRING, table: OPTIONAL_STRING,