diff --git a/src/types.ts b/src/types.ts index 47c6bd3c..51461fe6 100644 --- a/src/types.ts +++ b/src/types.ts @@ -141,6 +141,12 @@ export type PrefabComponentOptionCategory = { label: string; extended?: boolean; members: string[]; + condition?: { + type: string; + option: string; + comparator: string; + value: string | boolean | number; + }; }; export type PrefabComponentOption = PrefabComponentOptionBase & diff --git a/src/validations/prefab/componentOption.ts b/src/validations/prefab/componentOption.ts index c9b625a5..b8bde9a8 100644 --- a/src/validations/prefab/componentOption.ts +++ b/src/validations/prefab/componentOption.ts @@ -34,7 +34,7 @@ const optionConfigurationSchemaBase = { allowedInput: Joi.array().items( Joi.object({ name: Joi.string().allow(''), - value: Joi.any(), + value: Joi.alternatives().try(Joi.boolean(), Joi.string(), Joi.number()), }), ), allowedTypes: Joi.array().items(Joi.string()), diff --git a/src/validations/prefab/linkedOption.ts b/src/validations/prefab/linkedOption.ts index b776d602..e6e3d11a 100644 --- a/src/validations/prefab/linkedOption.ts +++ b/src/validations/prefab/linkedOption.ts @@ -4,12 +4,19 @@ import { COMPARATORS, CONDITION_TYPE, CONFIGURATION_AS } from '../constants'; const linkedOptionValueSchema = Joi.object({ ref: Joi.object({ componentId: Joi.string().required(), - optionId: Joi.string().required(), + optionId: Joi.string().optional(), }), }); export const linkedOptionConfigurationSchema = Joi.object({ as: Joi.string().valid(...CONFIGURATION_AS), + dataType: Joi.string(), + allowedInput: Joi.array().items( + Joi.object({ + name: Joi.string(), + value: Joi.alternatives().try(Joi.boolean(), Joi.string(), Joi.number()), + }), + ), condition: Joi.object({ type: Joi.string().valid(...CONDITION_TYPE), option: Joi.string(),