1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-09 00:18:00 +01:00
unleash.unleash/src/lib/services/project-schema.ts
Thomas Heartman 3fb53737c6
feat: include CR envs enabled on creation in event and update validation (#6931)
This PR improves the handling of change request enables on project
creation in two ways:

1. We now verify that the envs you try to enable CRs for exist before
passing them on to the enterprise functionality.
2. We include data about environments and change request environments in
the project created events.
2024-04-26 07:21:29 +02:00

30 lines
1.0 KiB
TypeScript

import joi from 'joi';
import { nameType } from '../routes/util';
export const projectSchema = joi
.object()
.keys({
id: nameType,
name: joi.string().required(),
description: joi.string().allow(null).allow('').optional(),
mode: joi
.string()
.valid('open', 'protected', 'private')
.default('open'),
defaultStickiness: joi.string().default('default'),
featureLimit: joi.number().allow(null).optional(),
featureNaming: joi.object().keys({
pattern: joi.string().allow(null).allow('').optional(),
example: joi.string().allow(null).allow('').optional(),
description: joi.string().allow(null).allow('').optional(),
}),
environments: joi.array().items(joi.string()),
changeRequestEnvironments: joi.array().items(
joi.object({
name: joi.string(),
requiredApprovals: joi.number(),
}),
),
})
.options({ allowUnknown: false, stripUnknown: true });