Fix open api specs for MULTI_SELECT (#8494)
## Before  ## After 
This commit is contained in:
@ -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',
|
||||
|
||||
@ -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),
|
||||
|
||||
Reference in New Issue
Block a user