Skip to content

Commit

Permalink
Fix open api specs for MULTI_SELECT (#8494)
Browse files Browse the repository at this point in the history
  • Loading branch information
martmull authored and charlesBochet committed Nov 15, 2024
1 parent 8cbb579 commit c50db46
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit c50db46

Please sign in to comment.