Skip to content

Commit

Permalink
fix: marketo bulk ignore null while checking data type mismatch (#3263)
Browse files Browse the repository at this point in the history
  • Loading branch information
shrouti1507 authored Apr 9, 2024
1 parent 9c6b251 commit 6e3274b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ describe('checkEventStatusViaSchemaMatching', () => {
});

// The function correctly handles events with null values.
it('should correctly handle events with null values', () => {
it('should ignore event properties with null values', () => {
const event = {
input: [
{
Expand All @@ -537,8 +537,6 @@ describe('checkEventStatusViaSchemaMatching', () => {

const result = checkEventStatusViaSchemaMatching(event, fieldSchemaMapping);

expect(result).toEqual({
job1: 'invalid id',
});
expect(result).toEqual({});
});
});
8 changes: 6 additions & 2 deletions src/v0/destinations/marketo_bulk_upload/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const {
RetryableError,
NetworkError,
TransformationError,
isDefinedAndNotNull,
} = require('@rudderstack/integrations-lib');
const { handleHttpRequest } = require('../../../adapters/network');
const tags = require('../../util/tags');
Expand Down Expand Up @@ -360,7 +361,6 @@ const getFieldSchemaMap = async (accessToken, munchkinId) => {
module: 'router',
},
);

if (fieldSchemaMapping.response.errors) {
handleCommonErrorResponse(
fieldSchemaMapping,
Expand Down Expand Up @@ -411,7 +411,11 @@ const checkEventStatusViaSchemaMatching = (event, fieldMap) => {
const expectedDataType = SCHEMA_DATA_TYPE_MAP[fieldMap[paramName]];
const actualDataType = typeof paramValue;

if (!mismatchedFields[job_id] && actualDataType !== expectedDataType) {
if (
isDefinedAndNotNull(paramValue) &&
!mismatchedFields[job_id] &&
actualDataType !== expectedDataType
) {
mismatchedFields[job_id] = `invalid ${paramName}`;
}
});
Expand Down

0 comments on commit 6e3274b

Please sign in to comment.