Common - Field validation (#15491)
Closes : https://github.com/twentyhq/core-team-issues/issues/1622 To do in other PR : - Add migration command for non nullable text, raw_json & array fields - Add null transformation --------- Co-authored-by: Weiko <corentin@twenty.com>
This commit is contained in:
+4
-8
@@ -32,9 +32,9 @@ describe('computeSchemaComponents', () => {
|
||||
"lastName": "Osinski",
|
||||
},
|
||||
"fieldLinks": {
|
||||
"additionalLinks": [],
|
||||
"primaryLinkLabel": "",
|
||||
"primaryLinkUrl": "https://narrow-help.net/",
|
||||
"secondaryLinks": [],
|
||||
},
|
||||
"fieldMultiSelect": [
|
||||
"OPTION_1",
|
||||
@@ -46,9 +46,7 @@ describe('computeSchemaComponents', () => {
|
||||
"primaryPhoneCountryCode": "FR",
|
||||
"primaryPhoneNumber": "06 10 20 30 40",
|
||||
},
|
||||
"fieldSelect": [
|
||||
"OPTION_1",
|
||||
],
|
||||
"fieldSelect": "OPTION_1",
|
||||
},
|
||||
"properties": {
|
||||
"fieldActor": {
|
||||
@@ -535,9 +533,9 @@ describe('computeSchemaComponents', () => {
|
||||
"lastName": "Jones",
|
||||
},
|
||||
"fieldLinks": {
|
||||
"additionalLinks": [],
|
||||
"primaryLinkLabel": "",
|
||||
"primaryLinkUrl": "https://unlawful-blowgun.biz",
|
||||
"secondaryLinks": [],
|
||||
},
|
||||
"fieldMultiSelect": [
|
||||
"OPTION_1",
|
||||
@@ -549,9 +547,7 @@ describe('computeSchemaComponents', () => {
|
||||
"primaryPhoneCountryCode": "FR",
|
||||
"primaryPhoneNumber": "06 10 20 30 40",
|
||||
},
|
||||
"fieldSelect": [
|
||||
"OPTION_1",
|
||||
],
|
||||
"fieldSelect": "OPTION_1",
|
||||
},
|
||||
"properties": {
|
||||
"fieldActor": {
|
||||
|
||||
+3
-3
@@ -58,7 +58,7 @@ export const generateRandomFieldValue = ({
|
||||
return {
|
||||
primaryLinkLabel: '',
|
||||
primaryLinkUrl: faker.internet.url(),
|
||||
additionalLinks: [],
|
||||
secondaryLinks: [],
|
||||
};
|
||||
}
|
||||
|
||||
@@ -82,10 +82,10 @@ export const generateRandomFieldValue = ({
|
||||
|
||||
case FieldMetadataType.SELECT: {
|
||||
if (!isDefined(field.options) || !isDefined(field.options[0].value)) {
|
||||
return [];
|
||||
return null;
|
||||
}
|
||||
|
||||
return [field.options[0].value];
|
||||
return field.options[0].value;
|
||||
}
|
||||
|
||||
case FieldMetadataType.MULTI_SELECT: {
|
||||
|
||||
Reference in New Issue
Block a user