Skip to content

fix: ensure API key values are converted to strings in Postman collec… #3911

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

Merged

Conversation

pooja-bruno
Copy link
Collaborator

@pooja-bruno pooja-bruno commented Jan 30, 2025

Description

When importing an API key authentication with a key and value, the value is now explicitly converted to a string. This conversion is necessary because Postman's schema does not strictly define the type of the value, allowing it to be modified to anything by directly editing the JSON.

PM Schema:

{
  "type": "object",
  "title": "Auth",
  "$id": "#/definitions/auth-attribute",
  "description": "Represents an attribute for any authorization method provided by Postman. For example `username` and `password` are set as auth attributes for Basic Authentication method.",
  "properties": {
    "key": {
      "type": "string"
    },
    "value": {},
    "type": {
      "type": "string"
    }
  },
  "required": [
    "key"
  ]
} 

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.

@sanish-bruno
Copy link
Collaborator

Is there any chance that the value can be null or undefined and we are trying accessnull.toString() ?

@pooja-bruno
Copy link
Collaborator Author

Hey @sanish-bruno! that might be possible so I've added a check for that authValues.value?.toString() to handle potential null or undefined cases.

@helloanoop helloanoop merged commit 4598acd into usebruno:main Feb 3, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants