Skip to content

Commit 095c639

Browse files
authored
Core: fix spurious validation warnings on mediaType / ortb2Imp (prebid#14099)
1 parent 197cd89 commit 095c639

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

src/prebid.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ export function syncOrtb2(adUnit, mediaType) {
158158
deepSetValue(adUnit, `mediaTypes.${mediaType}.${key}`, ortbFieldValue);
159159
} else if (ortbFieldValue === undefined) {
160160
deepSetValue(adUnit, `ortb2Imp.${mediaType}.${key}`, mediaTypesFieldValue);
161-
} else {
161+
} else if (!deepEqual(mediaTypesFieldValue, ortbFieldValue)) {
162162
logWarn(`adUnit ${adUnit.code}: specifies conflicting ortb2Imp.${mediaType}.${key} and mediaTypes.${mediaType}.${key}, the latter will be ignored`, adUnit);
163163
deepSetValue(adUnit, `mediaTypes.${mediaType}.${key}`, ortbFieldValue);
164164
}

test/spec/banner_spec.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,23 @@ describe('banner', () => {
127127
assert.ok(logWarnSpy.calledOnce, 'expected warning was logged due to conflicting btype');
128128
});
129129

130+
it('should not warn if fields match', () => {
131+
const adUnit = {
132+
mediaTypes: {
133+
banner: {
134+
format: [{wratio: 1, hratio: 1}]
135+
}
136+
},
137+
ortb2Imp: {
138+
banner: {
139+
format: [{wratio: 1, hratio: 1}]
140+
}
141+
}
142+
}
143+
syncOrtb2(adUnit, 'banner');
144+
sinon.assert.notCalled(logWarnSpy);
145+
})
146+
130147
it('should omit sync if mediaType not present on adUnit', () => {
131148
const adUnit = {
132149
mediaTypes: {

0 commit comments

Comments
 (0)