diff --git a/src/v0/destinations/marketo_bulk_upload/config.js b/src/v0/destinations/marketo_bulk_upload/config.js index 36b3c2ff93..e3268711fe 100644 --- a/src/v0/destinations/marketo_bulk_upload/config.js +++ b/src/v0/destinations/marketo_bulk_upload/config.js @@ -33,6 +33,7 @@ const SCHEMA_DATA_TYPE_MAP = { email: 'string', phone: 'string', url: 'string', + object: 'object', }; module.exports = { diff --git a/src/v0/destinations/marketo_bulk_upload/marketo_bulk_upload.util.test.js b/src/v0/destinations/marketo_bulk_upload/marketo_bulk_upload.util.test.js index 8d40d303ed..875b0d8280 100644 --- a/src/v0/destinations/marketo_bulk_upload/marketo_bulk_upload.util.test.js +++ b/src/v0/destinations/marketo_bulk_upload/marketo_bulk_upload.util.test.js @@ -357,7 +357,7 @@ describe('getAccessToken', () => { describe('checkEventStatusViaSchemaMatching', () => { // The function correctly identifies fields with expected data types. - it('should correctly identify fields with expected data types', () => { + it('if event data types match with expected data types we send no field as mismatch', () => { const event = { input: [ { @@ -384,7 +384,7 @@ describe('checkEventStatusViaSchemaMatching', () => { }); // The function correctly identifies fields with unexpected data types. - it('should correctly identify fields with unexpected data types', () => { + it('if event data types do not match with expected data types we send that field as mismatch', () => { const event = { input: [ { @@ -413,7 +413,7 @@ describe('checkEventStatusViaSchemaMatching', () => { }); // The function correctly handles events with multiple fields. - it('should correctly handle events with multiple fields', () => { + it('For array of events the mismatch object fills up with each event errors', () => { const event = { input: [ { @@ -454,7 +454,7 @@ describe('checkEventStatusViaSchemaMatching', () => { }); // The function correctly handles events with missing fields. - it('should have no effect with missing fields', () => { + it('it is not mandatory to send all the fields present in schema', () => { const event = { input: [ { @@ -480,7 +480,7 @@ describe('checkEventStatusViaSchemaMatching', () => { }); // The function correctly handles events with additional fields. But this will not happen in our use case - it('should correctly handle events with additional fields', () => { + it('for any field beyond schema fields will be mapped as invalid', () => { const event = { input: [ { diff --git a/src/v0/destinations/marketo_bulk_upload/util.js b/src/v0/destinations/marketo_bulk_upload/util.js index fb6a0b1365..fac04af431 100644 --- a/src/v0/destinations/marketo_bulk_upload/util.js +++ b/src/v0/destinations/marketo_bulk_upload/util.js @@ -402,14 +402,9 @@ const checkEventStatusViaSchemaMatching = (event, fieldMap) => { const { job_id } = metadata; Object.entries(message).forEach(([paramName, paramValue]) => { - let expectedDataType = SCHEMA_DATA_TYPE_MAP[fieldMap[paramName]]; + const expectedDataType = SCHEMA_DATA_TYPE_MAP[fieldMap[paramName]]; const actualDataType = typeof paramValue; - // If expectedDataType is not one of the primitive data types, treat it as a string - if (!['string', 'number', 'boolean', 'undefined'].includes(expectedDataType)) { - expectedDataType = 'string'; - } - if (!mismatchedFields[job_id] && actualDataType !== expectedDataType) { mismatchedFields[job_id] = `invalid ${paramName}`; }