2021-08-12 15:04:37 +02:00
|
|
|
import joi from 'joi';
|
2021-08-13 10:36:19 +02:00
|
|
|
import { nameType } from '../routes/util';
|
2021-08-12 15:04:37 +02:00
|
|
|
import { tagTypeSchema } from '../services/tag-type-schema';
|
2023-07-14 10:49:34 +02:00
|
|
|
import { installationDefinitionSchema } from './installation-definition-schema';
|
2021-01-19 10:42:45 +01:00
|
|
|
|
2021-08-12 15:04:37 +02:00
|
|
|
export const addonDefinitionSchema = joi.object().keys({
|
2021-01-19 10:42:45 +01:00
|
|
|
name: nameType,
|
|
|
|
displayName: joi.string(),
|
|
|
|
documentationUrl: joi.string().uri({ scheme: [/https?/] }),
|
|
|
|
description: joi.string().allow(''),
|
2023-07-14 10:49:34 +02:00
|
|
|
deprecated: joi.boolean().optional().default(false),
|
2021-01-19 10:42:45 +01:00
|
|
|
parameters: joi
|
|
|
|
.array()
|
|
|
|
.optional()
|
|
|
|
.items(
|
|
|
|
joi.object().keys({
|
|
|
|
name: joi.string().required(),
|
|
|
|
displayName: joi.string().required(),
|
|
|
|
type: joi.string().required(),
|
|
|
|
description: joi.string(),
|
|
|
|
placeholder: joi.string().allow(''),
|
|
|
|
required: joi.boolean().default(false),
|
2021-02-04 11:02:58 +01:00
|
|
|
sensitive: joi.boolean().default(false),
|
2021-01-19 10:42:45 +01:00
|
|
|
}),
|
|
|
|
),
|
2021-08-12 15:04:37 +02:00
|
|
|
events: joi.array().optional().items(joi.string()),
|
|
|
|
tagTypes: joi.array().optional().items(tagTypeSchema),
|
2023-07-14 10:49:34 +02:00
|
|
|
installation: installationDefinitionSchema.optional(),
|
|
|
|
alerts: joi
|
|
|
|
.array()
|
|
|
|
.optional()
|
|
|
|
.items(
|
|
|
|
joi.object().keys({
|
|
|
|
type: joi.string().valid('success', 'info', 'warning', 'error'),
|
|
|
|
text: joi.string().required(),
|
|
|
|
}),
|
|
|
|
),
|
2021-01-19 10:42:45 +01:00
|
|
|
});
|