From e77a9adebd71801f01c55393e75d295753868f48 Mon Sep 17 00:00:00 2001 From: Yuliya Bagriy Date: Tue, 24 Oct 2023 00:20:30 +0600 Subject: [PATCH] handle non-methods on OpenAPI import --- .../src/utils/importers/openapi-collection.js | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/packages/bruno-app/src/utils/importers/openapi-collection.js b/packages/bruno-app/src/utils/importers/openapi-collection.js index 0b419568..5fbccb8d 100644 --- a/packages/bruno-app/src/utils/importers/openapi-collection.js +++ b/packages/bruno-app/src/utils/importers/openapi-collection.js @@ -326,17 +326,21 @@ const parseOpenApiCollection = (data) => { let allRequests = Object.entries(collectionData.paths) .map(([path, methods]) => { - return Object.entries(methods).map(([method, operationObject]) => { - return { - method: method, - path: path, - operationObject: operationObject, - global: { - server: baseUrl, - security: securityConfig - } - }; - }); + return Object.entries(methods) + .filter(([method, op]) => { + ['get', 'put', 'post', 'delete', 'options', 'head', 'patch', 'trace'].includes(method.toLowerCase()); + }) + .map(([method, operationObject]) => { + return { + method: method, + path: path, + operationObject: operationObject, + global: { + server: baseUrl, + security: securityConfig + } + }; + }); }) .reduce((acc, val) => acc.concat(val), []); // flatten