[PR #5704] [MERGED] fix(common): environment variable mapping when referencing other variables #5324

Closed
opened 2026-03-17 02:46:54 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/hoppscotch/hoppscotch/pull/5704
Author: @AaronFortG
Created: 12/17/2025
Status: Merged
Merged: 1/14/2026
Merged by: @jamesgeorge007

Base: nextHead: fix/environment-variables-import


📝 Commits (2)

  • d79c8d9 fix: map correctly the environment variables when they reference another variable
  • 14d6cca refactor: fixed linting application only for the changed lines

📊 Changes

2 files changed (+4 additions, -3 deletions)

View changed files

📝 packages/hoppscotch-common/src/helpers/import-export/import/postman.ts (+1 -1)
📝 packages/hoppscotch-common/src/helpers/import-export/import/postmanEnv.ts (+3 -2)

📄 Description

Closes #5667

As stated in the Issue #5667, environment variables that referenced another variable were not correctly parsed when import from Postman. This means that if FULL_URL variable references {{SCHEMA}}://{{URL}} in Postman, the variable's value kept the same in Hoppscotch (including the {{ and }} characters).

What's changed

  • Made the replacePMVarTemplating function public by exporting it from postman.ts, allowing it to be reused in other modules.
  • Updated the Postman environment importer to apply replacePMVarTemplating to both initialValue and currentValue of imported variables, ensuring consistent variable templating format.
  • Imported the now-exported replacePMVarTemplating function into postmanEnv.ts to support the above change.

Example of the change

This is the actual environment in Postman:

image

Before the change:

image

After the change:

image

Summary by cubic

Fixes Postman environment import so variables that reference other variables are parsed and resolved correctly. Values like {{SCHEMA}}://{{URL}} now use Hoppscotch templating and work as expected.

  • Bug Fixes
    • Exported replacePMVarTemplating and applied it during env import.
    • Converted templating for both initialValue and currentValue.

Written for commit 14d6cca91f. Summary will update automatically on new commits.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/hoppscotch/hoppscotch/pull/5704 **Author:** [@AaronFortG](https://github.com/AaronFortG) **Created:** 12/17/2025 **Status:** ✅ Merged **Merged:** 1/14/2026 **Merged by:** [@jamesgeorge007](https://github.com/jamesgeorge007) **Base:** `next` ← **Head:** `fix/environment-variables-import` --- ### 📝 Commits (2) - [`d79c8d9`](https://github.com/hoppscotch/hoppscotch/commit/d79c8d97c06c8ffaddbfa684e26e83bcb6fb6377) fix: map correctly the environment variables when they reference another variable - [`14d6cca`](https://github.com/hoppscotch/hoppscotch/commit/14d6cca91fe169c5cf53f752a721128b5bdbfbca) refactor: fixed linting application only for the changed lines ### 📊 Changes **2 files changed** (+4 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `packages/hoppscotch-common/src/helpers/import-export/import/postman.ts` (+1 -1) 📝 `packages/hoppscotch-common/src/helpers/import-export/import/postmanEnv.ts` (+3 -2) </details> ### 📄 Description Closes #5667 As stated in the Issue #5667, **environment variables** that referenced another variable were not correctly parsed when import from Postman. This means that if `FULL_URL` variable references `{{SCHEMA}}://{{URL}}` in Postman, the variable's value kept the same in Hoppscotch (including the `{{` and `}}` characters). ### What's changed * Made the `replacePMVarTemplating` function public by exporting it from `postman.ts`, allowing it to be reused in other modules. * Updated the Postman environment importer to apply `replacePMVarTemplating` to both `initialValue` and `currentValue` of imported variables, ensuring consistent variable templating format. * Imported the now-exported `replacePMVarTemplating` function into `postmanEnv.ts` to support the above change. ### Example of the change This is the actual environment in Postman: <img width="1177" height="387" alt="image" src="https://github.com/user-attachments/assets/d30a34f7-cd0e-46e4-889e-06102dc87338" /> Before the change: <img width="559" height="265" alt="image" src="https://github.com/user-attachments/assets/8c38a788-7cef-42ac-bdc7-0e4aa98a3276" /> After the change: <img width="652" height="231" alt="image" src="https://github.com/user-attachments/assets/a871d24c-8642-434d-8dd0-f5d6ad4a82cd" /> <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Fixes Postman environment import so variables that reference other variables are parsed and resolved correctly. Values like {{SCHEMA}}://{{URL}} now use Hoppscotch templating and work as expected. - **Bug Fixes** - Exported replacePMVarTemplating and applied it during env import. - Converted templating for both initialValue and currentValue. <sup>Written for commit 14d6cca91fe169c5cf53f752a721128b5bdbfbca. Summary will update automatically on new commits.</sup> <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-17 02:46:54 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hoppscotch#5324
No description provided.