mirror of
https://github.com/postmanlabs/openapi-to-postman.git
synced 2022-11-29 22:05:00 +03:00
webhooks scenarios
This commit is contained in:
@@ -212,17 +212,18 @@ function safeSchemaFaker(oldSchema, resolveTo, resolveFor, parameterSourceOption
|
||||
* @returns {object} the concatenation of paths and webhooks
|
||||
*/
|
||||
function concatPathsAndWebhooks(schema) {
|
||||
let schemaPathItems = {};
|
||||
_.forOwn(schema.paths, (pathItemObject) => {
|
||||
let schemaPathItems = {},
|
||||
deepCopy = _.cloneDeep(schema);
|
||||
_.forOwn(deepCopy.paths, (pathItemObject) => {
|
||||
pathItemObject.kind = 'paths';
|
||||
});
|
||||
schemaPathItems = schema.paths;
|
||||
schemaPathItems = deepCopy.paths;
|
||||
|
||||
if (schema.webhooks) {
|
||||
_.forOwn(schema.webhooks, (webhookItemObject) => {
|
||||
if (deepCopy.webhooks) {
|
||||
_.forOwn(deepCopy.webhooks, (webhookItemObject) => {
|
||||
webhookItemObject.kind = 'webhooks';
|
||||
});
|
||||
schemaPathItems = Object.assign(schemaPathItems, schema.webhooks);
|
||||
schemaPathItems = Object.assign(schemaPathItems, deepCopy.webhooks);
|
||||
}
|
||||
return schemaPathItems;
|
||||
}
|
||||
@@ -4566,9 +4567,10 @@ module.exports = {
|
||||
*/
|
||||
getMissingSchemaEndpoints: function (schema, matchedEndpoints, components, options, schemaCache) {
|
||||
let endpoints = [],
|
||||
schemaPaths = schema.paths,
|
||||
// schemaPaths = schema.paths,
|
||||
rootCollectionVariables,
|
||||
schemaJsonPath;
|
||||
schemaJsonPath,
|
||||
schemaPathItems;
|
||||
|
||||
// collection variables generated for resolving for baseUrl and variables
|
||||
rootCollectionVariables = this.convertToPmCollectionVariables(
|
||||
@@ -4576,10 +4578,10 @@ module.exports = {
|
||||
'baseUrl',
|
||||
schema.baseUrl
|
||||
);
|
||||
|
||||
_.forEach(schemaPaths, (schemaPathObj, schemaPath) => {
|
||||
schemaPathItems = concatPathsAndWebhooks(schema);
|
||||
_.forEach(schemaPathItems, (schemaPathObj, schemaPath) => {
|
||||
_.forEach(_.keys(schemaPathObj), (pathKey) => {
|
||||
schemaJsonPath = `$.paths[${schemaPath}].${_.toLower(pathKey)}`;
|
||||
schemaJsonPath = `$.${schemaPathObj.kind}[${schemaPath}].${_.toLower(pathKey)}`;
|
||||
if (METHODS.includes(pathKey) && !matchedEndpoints.includes(schemaJsonPath)) {
|
||||
let mismatchObj = {
|
||||
property: 'ENDPOINT',
|
||||
|
||||
Reference in New Issue
Block a user