Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validation module: jsdoc fixes #11952

Merged
merged 4 commits into from
Jul 9, 2024
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
8 changes: 5 additions & 3 deletions modules/rtdModule/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,12 @@ let _dataProviders = [];
let _userConsent;

/**
* Register a RTD submodule.
* Register a Real-Time Data (RTD) submodule.
*
* @param {RtdSubmodule} submodule
* @returns {function()} a de-registration function that will unregister the module when called.
* @param {Object} submodule The RTD submodule to register.
* @param {string} submodule.name The name of the RTD submodule.
* @param {number} [submodule.gvlid] The Global Vendor List ID (GVLID) of the RTD submodule.
* @returns {function(): void} A de-registration function that will unregister the module when called.
*/
export function attachRealTimeDataProvider(submodule) {
registeredSubModules.push(submodule);
Expand Down
3 changes: 3 additions & 0 deletions modules/userId/eids.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import {deepAccess, deepClone, isFn, isPlainObject, isStr} from '../../src/utils.js';
/*
* @typedef {import('../modules/userId/index.js').SubmoduleContainer} SubmoduleContainer
*/

export const EID_CONFIG = new Map();

Expand Down
39 changes: 22 additions & 17 deletions modules/validationFpdModule/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ let optout;

/**
* Check if data passed is empty
* @param {*} value to test against
* @returns {Boolean} is value empty
* @param {*} data to test against
* @returns {Boolean} is data empty
*/
function isEmptyData(data) {
let check = true;
Expand All @@ -30,10 +30,10 @@ function isEmptyData(data) {

/**
* Check if required keys exist in data object
* @param {Object} data object
* @param {Array} array of required keys
* @param {String} object path (for printing warning)
* @param {Number} index of object value in the data array (for printing warning)
* @param {Object} obj data object
* @param {Array} required array of required keys
* @param {String} parent object path (for printing warning)
* @param {Number} i index of object value in the data array (for printing warning)
* @returns {Boolean} is requirements fulfilled
*/
function getRequiredData(obj, required, parent, i) {
Expand All @@ -51,8 +51,8 @@ function getRequiredData(obj, required, parent, i) {

/**
* Check if data type is valid
* @param {*} value to test against
* @param {Object} object containing type definition and if should be array bool
* @param {*} data value to test against
* @param {Object} mapping object containing type definition and if should be array bool
* @returns {Boolean} is type fulfilled
*/
function typeValidation(data, mapping) {
Expand All @@ -77,10 +77,10 @@ function typeValidation(data, mapping) {

/**
* Validates ortb2 data arrays and filters out invalid data
* @param {Array} ortb2 data array
* @param {Object} object defining child type and if array
* @param {String} config path of data array
* @param {String} parent path for logging warnings
* @param {Array} arr ortb2 data array
* @param {Object} child object defining child type and if array
* @param {String} path config path of data array
* @param {String} parent parent path for logging warnings
* @returns {Array} validated/filtered data
*/
export function filterArrayData(arr, child, path, parent) {
Expand Down Expand Up @@ -136,9 +136,9 @@ export function filterArrayData(arr, child, path, parent) {

/**
* Validates ortb2 object and filters out invalid data
* @param {Object} ortb2 object
* @param {String} config path of data array
* @param {String} parent path for logging warnings
* @param {Object} fpd ortb2 object
* @param {String} path config path of data array
* @param {String} parent parent path for logging warnings
* @returns {Object} validated/filtered data
*/
export function validateFpd(fpd, path = '', parent = '') {
Expand Down Expand Up @@ -190,6 +190,8 @@ export function validateFpd(fpd, path = '', parent = '') {

/**
* Run validation on global and bidder config data for ortb2
* @param {Object} data global and bidder config data
* @returns {Object} validated data
*/
function runValidations(data) {
return {
Expand All @@ -200,6 +202,9 @@ function runValidations(data) {

/**
* Sets default values to ortb2 if exists and adds currency and ortb2 setConfig callbacks on init
* @param {Object} fpdConf configuration object
* @param {Object} data ortb2 data
* @returns {Object} processed data
*/
export function processFpd(fpdConf, data) {
// Checks for existsnece of pubcid optout cookie/storage
Expand All @@ -210,11 +215,11 @@ export function processFpd(fpdConf, data) {
return (!fpdConf.skipValidations) ? runValidations(data) : data;
}

/** @type {firstPartyDataSubmodule} */
/** @type {{name: string, queue: number, processFpd: function}} */
export const validationSubmodule = {
name: 'validation',
queue: 1,
processFpd
}

submodule('firstPartyData', validationSubmodule)
submodule('firstPartyData', validationSubmodule);