Skip to content

Commit c50db46

Browse files

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

packages/twenty-server/src/engine/core-modules/open-api/utils/__tests__/components.utils.spec.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ describe('computeSchemaComponents', () => {
125125
enum: ['OPTION_1', 'OPTION_2'],
126126
},
127127
fieldMultiSelect: {
128-
type: 'string',
129-
enum: ['OPTION_1', 'OPTION_2'],
128+
type: 'array',
129+
items: { type: 'string', enum: ['OPTION_1', 'OPTION_2'] },
130130
},
131131
fieldPosition: {
132132
type: 'number',
@@ -302,8 +302,8 @@ describe('computeSchemaComponents', () => {
302302
enum: ['OPTION_1', 'OPTION_2'],
303303
},
304304
fieldMultiSelect: {
305-
type: 'string',
306-
enum: ['OPTION_1', 'OPTION_2'],
305+
type: 'array',
306+
items: { type: 'string', enum: ['OPTION_1', 'OPTION_2'] },
307307
},
308308
fieldPosition: {
309309
type: 'number',
@@ -478,8 +478,8 @@ describe('computeSchemaComponents', () => {
478478
enum: ['OPTION_1', 'OPTION_2'],
479479
},
480480
fieldMultiSelect: {
481-
type: 'string',
482-
enum: ['OPTION_1', 'OPTION_2'],
481+
type: 'array',
482+
items: { type: 'string', enum: ['OPTION_1', 'OPTION_2'] },
483483
},
484484
fieldPosition: {
485485
type: 'number',

packages/twenty-server/src/engine/core-modules/open-api/utils/components.utils.ts

+11-1
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,18 @@ const getSchemaComponentsProperties = ({
115115
let itemProperty = {} as Property;
116116

117117
switch (field.type) {
118-
case FieldMetadataType.SELECT:
119118
case FieldMetadataType.MULTI_SELECT:
119+
itemProperty = {
120+
type: 'array',
121+
items: {
122+
type: 'string',
123+
enum: field.options.map(
124+
(option: { value: string }) => option.value,
125+
),
126+
},
127+
};
128+
break;
129+
case FieldMetadataType.SELECT:
120130
itemProperty = {
121131
type: 'string',
122132
enum: field.options.map((option: { value: string }) => option.value),

0 commit comments

Comments
 (0)