From 55850cb43bbdbe93a43463275b4a45be97f56f0e Mon Sep 17 00:00:00 2001 From: TheBlackReverand Date: Mon, 15 Apr 2024 18:28:06 +0200 Subject: [PATCH] Parse environments extension --- .../src/utils/importers/openapi-collection.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/packages/bruno-app/src/utils/importers/openapi-collection.js b/packages/bruno-app/src/utils/importers/openapi-collection.js index d579402cd..66737f634 100644 --- a/packages/bruno-app/src/utils/importers/openapi-collection.js +++ b/packages/bruno-app/src/utils/importers/openapi-collection.js @@ -406,6 +406,25 @@ export const parseOpenApiCollection = (data) => { let securityConfig = getSecurity(collectionData); + if(collectionData['x-bruno-environments']) { + collectionData['x-bruno-environments'].forEach(env => { + brunoCollection.environments.push({ + uid: uuid(), + name: env.name, + variables: env.variables.map(variable => { + return { + uid: uuid(), + name: variable.name, + value: variable.value ?? '', + type: variable.type ?? 'text', + enabled: variable.enabled ?? true, + secret: variable.secret ?? false + }; + }) + }); + }); + } + let allRequests = Object.entries(collectionData.paths) .map(([path, methods]) => { return Object.entries(methods)