Skip to content

The open alternative to Salesforce, designed for AI.

fix(server): correct OpenAPI schema for phones.additionalPhones (#20631)

Hachem Ouanescd09690d5dfa
diff --git a/packages/twenty-server/src/engine/core-modules/open-api/utils/__tests__/components.utils.spec.ts b/packages/twenty-server/src/engine/core-modules/open-api/utils/__tests__/components.utils.spec.ts
index ca960dfd9fe..d8a0e6e78ca 100644
--- a/packages/twenty-server/src/engine/core-modules/open-api/utils/__tests__/components.utils.spec.ts
+++ b/packages/twenty-server/src/engine/core-modules/open-api/utils/__tests__/components.utils.spec.ts
@@ -259,7 +259,18 @@ describe('computeSchemaComponents', () => {
"properties": {
"additionalPhones": {
"items": {
- "type": "string",
+ "properties": {
+ "callingCode": {
+ "type": "string",
+ },
+ "countryCode": {
+ "type": "string",
+ },
+ "number": {
+ "type": "string",
+ },
+ },
+ "type": "object",
},
"type": "array",
},
@@ -491,7 +502,18 @@ describe('computeSchemaComponents', () => {
"properties": {
"additionalPhones": {
"items": {
- "type": "string",
+ "properties": {
+ "callingCode": {
+ "type": "string",
+ },
+ "countryCode": {
+ "type": "string",
+ },
+ "number": {
+ "type": "string",
+ },
+ },
+ "type": "object",
},
"type": "array",
},
@@ -752,7 +774,18 @@ describe('computeSchemaComponents', () => {
"properties": {
"additionalPhones": {
"items": {
- "type": "string",
+ "properties": {
+ "callingCode": {
+ "type": "string",
+ },
+ "countryCode": {
+ "type": "string",
+ },
+ "number": {
+ "type": "string",
+ },
+ },
+ "type": "object",
},
"type": "array",
},
diff --git a/packages/twenty-server/src/engine/utils/convert-object-metadata-to-schema-properties.util.ts b/packages/twenty-server/src/engine/utils/convert-object-metadata-to-schema-properties.util.ts
index b98ee47054c..98ab50ef758 100644
--- a/packages/twenty-server/src/engine/utils/convert-object-metadata-to-schema-properties.util.ts
+++ b/packages/twenty-server/src/engine/utils/convert-object-metadata-to-schema-properties.util.ts
@@ -308,7 +308,18 @@ export const convertObjectMetadataToSchemaProperties = ({
additionalPhones: {
type: 'array',
items: {
- type: 'string',
+ type: 'object',
+ properties: {
+ number: {
+ type: 'string',
+ },
+ countryCode: {
+ type: 'string',
+ },
+ callingCode: {
+ type: 'string',
+ },
+ },
},
},
primaryPhoneCountryCode: {