martmull 2024-11-14 12:07:31 +01:00 committed by GitHub
parent 9ac949dec8
commit 090f612c4b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 7 deletions

View File

@ -125,8 +125,8 @@ describe('computeSchemaComponents', () => {
enum: ['OPTION_1', 'OPTION_2'],
},
fieldMultiSelect: {
type: 'string',
enum: ['OPTION_1', 'OPTION_2'],
type: 'array',
items: { type: 'string', enum: ['OPTION_1', 'OPTION_2'] },
},
fieldPosition: {
type: 'number',
@ -302,8 +302,8 @@ describe('computeSchemaComponents', () => {
enum: ['OPTION_1', 'OPTION_2'],
},
fieldMultiSelect: {
type: 'string',
enum: ['OPTION_1', 'OPTION_2'],
type: 'array',
items: { type: 'string', enum: ['OPTION_1', 'OPTION_2'] },
},
fieldPosition: {
type: 'number',
@ -478,8 +478,8 @@ describe('computeSchemaComponents', () => {
enum: ['OPTION_1', 'OPTION_2'],
},
fieldMultiSelect: {
type: 'string',
enum: ['OPTION_1', 'OPTION_2'],
type: 'array',
items: { type: 'string', enum: ['OPTION_1', 'OPTION_2'] },
},
fieldPosition: {
type: 'number',

View File

@ -115,8 +115,18 @@ const getSchemaComponentsProperties = ({
let itemProperty = {} as Property;
switch (field.type) {
case FieldMetadataType.SELECT:
case FieldMetadataType.MULTI_SELECT:
itemProperty = {
type: 'array',
items: {
type: 'string',
enum: field.options.map(
(option: { value: string }) => option.value,
),
},
};
break;
case FieldMetadataType.SELECT:
itemProperty = {
type: 'string',
enum: field.options.map((option: { value: string }) => option.value),