Introduce ARRAY field type (#6862)

This PR was created by \[GitStart\](<https://gitstart.com/>) to address
the requirements from this ticket:
\[TWNTY-6447\](<https://clients.gitstart.com/twenty/5449/tickets/TWNTY-6447>).

This ticket was imported from:
<https://github.com/twentyhq/twenty/issues/6447>

### Description

\- We added a new field type

### Refs

#6447

### Demo

<https://jam.dev/c/2b4d7853-ea89-4e9d-a561-6edcb4fdb34b>

Fixes #6447

---------

Co-authored-by: gitstart-twenty <gitstart-twenty@users.noreply.github.com>
Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
gitstart-app[bot]
2024-09-16 14:07:55 +02:00
committed by GitHub
parent bc99cfec98
commit 8208a3e976
40 changed files with 392 additions and 28 deletions

View File

@ -70,6 +70,12 @@ describe('computeSchemaComponents', () => {
type: 'string',
format: 'date',
},
fieldArray: {
items: {
type: 'string',
},
type: 'array',
},
fieldBoolean: {
type: 'boolean',
},
@ -246,6 +252,12 @@ describe('computeSchemaComponents', () => {
type: 'string',
format: 'date',
},
fieldArray: {
items: {
type: 'string',
},
type: 'array',
},
fieldBoolean: {
type: 'boolean',
},
@ -421,6 +433,12 @@ describe('computeSchemaComponents', () => {
type: 'string',
format: 'date',
},
fieldArray: {
items: {
type: 'string',
},
type: 'array',
},
fieldBoolean: {
type: 'boolean',
},

View File

@ -17,8 +17,8 @@ import {
FieldMetadataType,
} from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
import { ObjectMetadataEntity } from 'src/engine/metadata-modules/object-metadata/object-metadata.entity';
import { capitalize } from 'src/utils/capitalize';
import { RelationMetadataType } from 'src/engine/metadata-modules/relation-metadata/relation-metadata.entity';
import { capitalize } from 'src/utils/capitalize';
type Property = OpenAPIV3_1.SchemaObject;
@ -124,6 +124,14 @@ const getSchemaComponentsProperties = ({
enum: field.options.map((option: { value: string }) => option.value),
};
break;
case FieldMetadataType.ARRAY:
itemProperty = {
type: 'array',
items: {
type: 'string',
},
};
break;
case FieldMetadataType.RATING:
itemProperty = {
type: 'string',