Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: all API keys are correctly added when importing OpenAPI collection #2302

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Nithishvb
Copy link

Description

Fixes: #2254

This PR addresses the issue where only one API key was being added to the collection when importing OpenAPI collection that contain multiple keys. The fix ensures that all API keys are correctly included during the import process.

Contribution Checklist:

  • The pull request only addresses one issue or adds one feature.
  • The pull request does not introduce any breaking changes
  • I have added screenshots or gifs to help explain the change if applicable.
  • I have read the contribution guidelines.
  • Create an issue and link to the pull request.

Note: Keeping the PR small and focused helps make it easier to review and merge. If you have multiple changes you want to make, please consider submitting them as separate pull requests.

Publishing to New Package Managers

Please see here for more information.

brunoRequestItem.request.headers.push({
uid: uuid(),
name: param.name,
value: '{{apiKey}}',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello,
With this line you generate a duplicated variable name, so you need to rework your collection after import.
Maybe a param.name in camelCase can do it?

value = '{{' +
   param.name
             .replace('x-', '')
             .replaceAll('-', ' ')
             .replace(/(?:^\w|[A-Z]|\b\w|\s+)/g, function(match, index) {
                  if (+match === 0) return ""; // or if (/\s+/.test(match)) for white spaces
                  return index === 0 ? match.toLowerCase() : match.toUpperCase();
              })
 + '}}';

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey , could you please explain how this code generate a duplicated variable name?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Import OpenAPI definition with multiple API keys: only one key is added to the collection
2 participants