Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion libraries/ortbConverter/processors/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {setResponseMediaType} from './mediaType.js';
import {fillNativeImp, fillNativeResponse} from './native.js';
import {BID_RESPONSE, IMP, REQUEST} from '../../../src/pbjsORTB.js';
import {clientSectionChecker} from '../../../src/fpd/oneClient.js';
import {schainProcessor} from './schain.js';

export const DEFAULT_PROCESSORS = {
[REQUEST]: {
Expand Down Expand Up @@ -32,7 +33,9 @@ export const DEFAULT_PROCESSORS = {
ortbRequest.tmax = timeout;
}
}
}
},
// Add the moveSchainToExt processor to move schain from source.schain to source.ext.schain
moveSchainToExt: schainProcessor[REQUEST].moveSchainToExt
},
[IMP]: {
fpd: {
Expand Down
32 changes: 32 additions & 0 deletions libraries/ortbConverter/processors/schain.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**
* This module handles the relocation of schain object from source.schain to source.ext.schain
*/
import {deepAccess, deepSetValue} from '../../../src/utils.js';
import {REQUEST} from '../../../src/pbjsORTB.js';

/**
* Processor to move schain from source.schain to source.ext.schain
* This ensures that the schain object is validated first and then moved to the ext object
*/
export const schainProcessor = {
[REQUEST]: {
moveSchainToExt: {
// Run this after validation but before the request is sent
priority: -50,
fn(ortbRequest, bidderRequest, context) {
// Check if source.schain exists in the ortbRequest
const schain = deepAccess(ortbRequest, 'source.schain');
if (schain) {
// Create ext object if it doesn't exist
if (!deepAccess(ortbRequest, 'source.ext')) {
deepSetValue(ortbRequest, 'source.ext', {});
}
// Move schain to ext.schain
deepSetValue(ortbRequest, 'source.ext.schain', schain);
// Remove original schain
delete ortbRequest.source.schain;
}
}
}
}
};
216 changes: 0 additions & 216 deletions modules/schain.js

This file was deleted.

51 changes: 0 additions & 51 deletions modules/schain.md

This file was deleted.

33 changes: 33 additions & 0 deletions modules/validationFpdModule/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,5 +145,38 @@ export const ORTB_MAP = {
type: TYPES.object,
isArray: true,
childType: TYPES.string
},
source: {
type: TYPES.object,
children: {
ext: {
type: TYPES.object,
isArray: false
},
schain: {
type: TYPES.object,
children: {
complete: { type: TYPES.number },
ver: { type: TYPES.string },
nodes: {
type: TYPES.object,
isArray: true,
childType: TYPES.object,
required: ['asi', 'sid', 'hp'],
children: {
asi: { type: TYPES.string },
sid: { type: TYPES.string },
hp: { type: TYPES.number },
rid: { type: TYPES.string },
name: { type: TYPES.string },
domain: { type: TYPES.string },
ext: { type: TYPES.object }
}
},
ext: { type: TYPES.object }
},
required: ['complete', 'nodes', 'ver']
}
}
}
}
Loading