diff --git a/__tests__/validations/component.test.tsx b/__tests__/validations/component.test.tsx index 1a19b208..0afafdfc 100644 --- a/__tests__/validations/component.test.tsx +++ b/__tests__/validations/component.test.tsx @@ -1175,3 +1175,35 @@ test('Success when value is an array with empty string in variable option', (t: t.notThrows(() => validatePrefabs(prefabs, {})); }); + +test('Success when adding createActionInputVariable in the option configuration of an ACTION_JS_INPUT', (t: Context): void => { + const prefabs: Prefab[] = [ + { + name: 'Component Name', + icon: 'TitleIcon', + category: 'CONTENT', + structure: [ + { + name: 'something', + options: [ + { + value: [''], + label: 'something', + key: 'something', + type: 'ACTION_JS_VARIABLE', + configuration: { + createActionInputVariable: { + name: 'Test Name', + type: 'STRING', + }, + }, + }, + ], + descendants: [], + }, + ], + }, + ]; + + t.notThrows(() => validatePrefabs(prefabs, {})); +}); diff --git a/src/validations/prefab/componentOption.ts b/src/validations/prefab/componentOption.ts index db15589b..5f3c806a 100644 --- a/src/validations/prefab/componentOption.ts +++ b/src/validations/prefab/componentOption.ts @@ -90,6 +90,17 @@ const optionConfigurationSchema = Joi.when('type', { }), otherwise: Joi.object(optionConfigurationSchemaBase), }) + .when('type', { + is: 'ACTION_JS_VARIABLE', + then: Joi.object({ + ...optionConfigurationSchemaBase, + createActionInputVariable: Joi.object({ + name: Joi.string().optional(), + type: Joi.string().required(), + value: Joi.string().allow('').optional(), + }), + }), + }) .when('type', { is: 'VARIABLE', then: Joi.object({