lib/routesHandler/lib/initializeRoutes.js
function (parametersList, parameters, section) {
            if (parameters[section]) {
                for (var name in parameters[section]) {
                    var addCondition = parameters[section][name];
                    if (parametersList[section] && parametersList[section][name]) {

                        // Merge parameters attributes
                        for (var attr in addCondition) {
                            if (_.has(parametersList, [section, name, attr]) === false) {
                                // Attribute does not exists -> add to list
                                parametersList[section][name][attr] = addCondition[attr];
                            } else {
                                // Attribute already exists compare values
                                if (_.isFunction(addCondition[attr])) {
                                    addCondition[attr] = _functionName(addCondition[attr]);
                                }

                                if (JSON.stringify(parametersList[section][name][attr]) != JSON.stringify(addCondition[attr])) {
                                    throw new Error("Precondition conflict: " + preconditions[index].name + ' -> ' + preconditions[index].version + ' -> ' + preconditions[index].method + ' -> ' + attr + ':' + addCondition[attr] + ' ->  already defined in previous controller and value is mismatching');
                                }
                                else {
                                    parametersList[section][name][attr] = addCondition[attr];
                                }
                            }
                        }
                    } else {
                        parametersList[section] = parametersList[section] ? parametersList[section] : {};
                        parametersList[section][name] = addCondition;
                    }

                    // Filter parameter attributes by allowedAttributes
                    var validatedParameterAttributes = {};
                    if (_.has(parametersList, [section, name])) {
                        for (var attr in parametersList[section][name]) {
                            validatedParameterAttributes[attr] = _removeAttributes(parametersList[section][name][attr], attr);
                        }
                    }

                    if (!_.isEmpty(validatedParameterAttributes)) {
                        parametersList[section][name] = validatedParameterAttributes;
                    }
                }
            }
            return parametersList;
        }
function (parametersList, parameters, section) {
            if (parameters[section]) {
                for (var name in parameters[section]) {
                    var addCondition = parameters[section][name];
                    if (parametersList[section] && parametersList[section][name]) {

                        // Merge parameters attributes
                        for (var attr in addCondition) {
                            if (_.has(parametersList, [section, name, attr]) === false) {
                                // Attribute does not exists -> add to list
                                parametersList[section][name][attr] = addCondition[attr];
                            } else {
                                // Attribute already exists compare values
                                if (_.isFunction(addCondition[attr])) {
                                    addCondition[attr] = _functionName(addCondition[attr]);
                                }

                                if (JSON.stringify(parametersList[section][name][attr]) != JSON.stringify(addCondition[attr])) {
                                    throw new Error("Precondition conflict: " + preconditions[index].name + ' -> ' + preconditions[index].version + ' -> ' + preconditions[index].method + ' -> ' + attr + ':' + addCondition[attr] + ' ->  already defined in previous controller and value is mismatching');
                                }
                                else {
                                    parametersList[section][name][attr] = addCondition[attr];
                                }
                            }
                        }
                    } else {
                        parametersList[section] = parametersList[section] ? parametersList[section] : {};
                        parametersList[section][name] = addCondition;
                    }

                    // Filter parameter attributes by allowedAttributes
                    var validatedParameterAttributes = {};
                    if (_.has(parametersList, [section, name])) {
                        for (var attr in parametersList[section][name]) {
                            validatedParameterAttributes[attr] = _removeAttributes(parametersList[section][name][attr], attr);
                        }
                    }

                    if (!_.isEmpty(validatedParameterAttributes)) {
                        parametersList[section][name] = validatedParameterAttributes;
                    }
                }
            }
            return parametersList;
        }
function ( parametersList , parameters , section ) { if ( parameters [ section ] ) { for ( var name in parameters [ section ] ) { var addCondition = parameters [ section ] [ name ] ; if ( parametersList [ section ] && parametersList [ section ] [ name ] ) { // Merge parameters attributes for ( var attr in addCondition ) { if ( _ . has ( parametersList , [ section , name , attr ] ) === false ) { // Attribute does not exists -> add to list parametersList [ section ] [ name ] [ attr ] = addCondition [ attr ] ; } else { // Attribute already exists compare values if ( _ . isFunction ( addCondition [ attr ] ) ) { addCondition [ attr ] = _functionName ( addCondition [ attr ] ) ; } if ( JSON . stringify ( parametersList [ section ] [ name ] [ attr ] ) != JSON . stringify ( addCondition [ attr ] ) ) { throw new Error ( "Precondition conflict: " + preconditions [ index ] . name + ' -> ' + preconditions [ index ] . version + ' -> ' + preconditions [ index ] . method + ' -> ' + attr + ':' + addCondition [ attr ] + ' ->  already defined in previous controller and value is mismatching' ) ; } else { parametersList [ section ] [ name ] [ attr ] = addCondition [ attr ] ; } } } } else { parametersList [ section ] = parametersList [ section ] ? parametersList [ section ] : { } ; parametersList [ section ] [ name ] = addCondition ; } // Filter parameter attributes by allowedAttributes var validatedParameterAttributes = { } ; if ( _ . has ( parametersList , [ section , name ] ) ) { for ( var attr in parametersList [ section ] [ name ] ) { validatedParameterAttributes [ attr ] = _removeAttributes ( parametersList [ section ] [ name ] [ attr ] , attr ) ; } } if ( ! _ . isEmpty ( validatedParameterAttributes ) ) { parametersList [ section ] [ name ] = validatedParameterAttributes ; } } } return parametersList ; }
Parse preconditions parameters in section header, query, body
Parse preconditions parameters in section header query body