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'],
|
enum: ['OPTION_1', 'OPTION_2'],
|
||||||
},
|
},
|
||||||
fieldMultiSelect: {
|
fieldMultiSelect: {
|
||||||
type: 'string',
|
type: 'array',
|
||||||
enum: ['OPTION_1', 'OPTION_2'],
|
items: { type: 'string', enum: ['OPTION_1', 'OPTION_2'] },
|
||||||
},
|
},
|
||||||
fieldPosition: {
|
fieldPosition: {
|
||||||
type: 'number',
|
type: 'number',
|
||||||
@ -302,8 +302,8 @@ describe('computeSchemaComponents', () => {
|
|||||||
enum: ['OPTION_1', 'OPTION_2'],
|
enum: ['OPTION_1', 'OPTION_2'],
|
||||||
},
|
},
|
||||||
fieldMultiSelect: {
|
fieldMultiSelect: {
|
||||||
type: 'string',
|
type: 'array',
|
||||||
enum: ['OPTION_1', 'OPTION_2'],
|
items: { type: 'string', enum: ['OPTION_1', 'OPTION_2'] },
|
||||||
},
|
},
|
||||||
fieldPosition: {
|
fieldPosition: {
|
||||||
type: 'number',
|
type: 'number',
|
||||||
@ -478,8 +478,8 @@ describe('computeSchemaComponents', () => {
|
|||||||
enum: ['OPTION_1', 'OPTION_2'],
|
enum: ['OPTION_1', 'OPTION_2'],
|
||||||
},
|
},
|
||||||
fieldMultiSelect: {
|
fieldMultiSelect: {
|
||||||
type: 'string',
|
type: 'array',
|
||||||
enum: ['OPTION_1', 'OPTION_2'],
|
items: { type: 'string', enum: ['OPTION_1', 'OPTION_2'] },
|
||||||
},
|
},
|
||||||
fieldPosition: {
|
fieldPosition: {
|
||||||
type: 'number',
|
type: 'number',
|
||||||
|
|||||||
@ -115,8 +115,18 @@ const getSchemaComponentsProperties = ({
|
|||||||
let itemProperty = {} as Property;
|
let itemProperty = {} as Property;
|
||||||
|
|
||||||
switch (field.type) {
|
switch (field.type) {
|
||||||
case FieldMetadataType.SELECT:
|
|
||||||
case FieldMetadataType.MULTI_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 = {
|
itemProperty = {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
enum: field.options.map((option: { value: string }) => option.value),
|
enum: field.options.map((option: { value: string }) => option.value),
|
||||||
|
|||||||
Reference in New Issue
Block a user