Update schemaUtils.js

handle diferent name of variables than baseUrl for webhooks
This commit is contained in:
Luis Tejeda
2022-01-27 15:44:37 -06:00
parent 384c23f01c
commit 71bafccee2

View File

@@ -4567,21 +4567,28 @@ module.exports = {
*/
getMissingSchemaEndpoints: function (schema, matchedEndpoints, components, options, schemaCache) {
let endpoints = [],
// schemaPaths = schema.paths,
rootCollectionVariables,
schemaJsonPath,
schemaPathItems;
// collection variables generated for resolving for baseUrl and variables
rootCollectionVariables = this.convertToPmCollectionVariables(
schema.baseUrlVariables,
'baseUrl',
schema.baseUrl
);
schemaPathItems = concatPathsAndWebhooks(schema);
_.forEach(schemaPathItems, (schemaPathObj, schemaPath) => {
_.forEach(_.keys(schemaPathObj), (pathKey) => {
schemaJsonPath = `$.${schemaPathObj.kind}[${schemaPath}].${_.toLower(pathKey)}`;
if (schemaPathObj.kind === 'webhooks') {
rootCollectionVariables = this.convertToPmCollectionVariables(
schema.baseUrlVariables,
schemaPath.startsWith('/') ? schemaPath.slice(1) : schemaPath,
schema.baseUrl
);
}
else {
// collection variables generated for resolving for baseUrl and variables
rootCollectionVariables = this.convertToPmCollectionVariables(
schema.baseUrlVariables,
'baseUrl',
schema.baseUrl
);
}
if (METHODS.includes(pathKey) && !matchedEndpoints.includes(schemaJsonPath)) {
let mismatchObj = {
property: 'ENDPOINT',