[GH-ISSUE #5515] [feature]: Custom Variable Priority #2123

Open
opened 2026-03-16 23:15:57 +03:00 by kerem · 1 comment
Owner

Originally created by @tldzyx on GitHub (Oct 26, 2025).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/5515

Is there an existing issue for this?

  • I have searched the existing issues

Summary

Variable Scope Color Priority
Request 🟠 1
Collection 🟣 2
Predefined 🟡 3
Environment 🟢 4
Global 🔵 5
Non resolvable 🔴 -

Features/Variables

Variable Scope Color Priority
Request 🟠 1
Predefined 🟡 2
Environment 🟢 3
Global 🔵 4
Collection 🟣 5
Non resolvable 🔴 -

Is there any way let sort change to bottom in order to support collection variable as default?

In my context, I will switch many host/port with the same request, it's work rigth in postman, but not in hoppscotch

Why should this be worked on?

for example: http://{{host}}:{{port}}{{prefix}}/a/b/c
I want set the collection variable point to the shared service as default export to my classmate, but I need switch environment let it point to my different devices, or the api has bug, my classmate need switch to my computer help me debug

Originally created by @tldzyx on GitHub (Oct 26, 2025). Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/5515 ### Is there an existing issue for this? - [x] I have searched the existing issues ### Summary [Features/Variables](https://docs.hoppscotch.io/documentation/features/variables) Variable Scope | Color | Priority -- | -- | -- Request | 🟠 | 1 Collection | 🟣 | 2 Predefined | 🟡 | 3 Environment | 🟢 | 4 Global | 🔵 | 5 Non resolvable | 🔴 | - ------ Is there any way let sort change to bottom in order to support collection variable as default? Variable Scope | Color | Priority -- | -- | -- Request | 🟠 | 1 Predefined | 🟡 | 2 Environment | 🟢 | 3 Global | 🔵 | 4 Collection | 🟣 | 5 Non resolvable | 🔴 | - ------ In my context, I will switch many host/port with the same request, it's work rigth in postman, but not in hoppscotch ### Why should this be worked on? for example: http://{{host}}:{{port}}{{prefix}}/a/b/c I want set the collection variable point to the shared service as default export to my classmate, but I need switch environment let it point to my different devices, or the api has bug, my classmate need switch to my computer help me debug
Author
Owner

@jazuntee commented on GitHub (Dec 20, 2025):

Setting a custom variable priority would certainly address what I am trying to do as well but could also make sharing collections much harder or more confusing because different collections might assume different priority handling. You could store the custom priority handling in the collection so an export/import would keep the intended order but now you lost the consistency of understanding which variables will be used. I think the default priority should actually be changed to allow this default value scenario.

Both Postman and Insomnia let you select an environment with higher priority than Collection. Insomnia actually has two environment slots so you can set environment variables before or after Collection scope resolution.
https://learning.postman.com/docs/sending-requests/variables/variables/#variable-scopes
https://developer.konghq.com/insomnia/environments/#environment-priority

To avoid breaking requests that already assume collection variables override environment variables. I propose another environment slot scope be introduced with higher priority than Collection so the user could choose which Environment variable set goes before and which comes after Collection resolution similar to Insomnia.

  1. Request
  2. Collection Environment
  3. Collection
  4. Predefined
  5. Global Environment
  6. Global

Environment scope is the only easily swappable variable set where you can have multiple options.
While Global, Collection, and Request scopes are fairly static because they can only have a single set of variables and only Request allows toggling individual variables on or off without removing the variable entirely. This makes setting defaults in a collection impossible to override based on environment which is quite limiting, and I suspect that is why Postman and Insomnia allow environment variables that can override Collection scope.

A simple example would be calling the OIDC config endpoint for Microsoft Entra ID. I want:
Collection Variables (Static list of variables for collection with default values):

  • EntraId-Hostname = login.microsoftonline.com (defaults to global cloud instance)
  • EntraId-TenantId = common (defaults to common endpoint that supports any tenant)
  • EntraId-OpenIdConfig = https://<<EntraId-Hostname>>/<<EntraId-TenantId>>/v2.0/.well-known/openid-configuration

Collection Environment Variables (easily swappable for different environments):

  • EntraId-Hostname = login.microsoftonline.us (overrides global cloud instance with us gov instance)
  • EntraId-TenantId = mydomain.com (override with my tenant)
<!-- gh-comment-id:3677977738 --> @jazuntee commented on GitHub (Dec 20, 2025): Setting a custom variable priority would certainly address what I am trying to do as well but could also make sharing collections much harder or more confusing because different collections might assume different priority handling. You could store the custom priority handling in the collection so an export/import would keep the intended order but now you lost the consistency of understanding which variables will be used. I think the default priority should actually be changed to allow this default value scenario. Both Postman and Insomnia let you select an environment with higher priority than Collection. Insomnia actually has two environment slots so you can set environment variables before or after Collection scope resolution. https://learning.postman.com/docs/sending-requests/variables/variables/#variable-scopes https://developer.konghq.com/insomnia/environments/#environment-priority To avoid breaking requests that already assume collection variables override environment variables. I propose another environment slot scope be introduced with higher priority than Collection so the user could choose which Environment variable set goes before and which comes after Collection resolution similar to Insomnia. 1. Request 2. Collection Environment 3. Collection 4. Predefined 5. Global Environment 6. Global Environment scope is the only easily swappable variable set where you can have multiple options. While Global, Collection, and Request scopes are fairly static because they can only have a single set of variables and only Request allows toggling individual variables on or off without removing the variable entirely. This makes setting defaults in a collection impossible to override based on environment which is quite limiting, and I suspect that is why Postman and Insomnia allow environment variables that can override Collection scope. A simple example would be calling the OIDC config endpoint for Microsoft Entra ID. I want: Collection Variables (Static list of variables for collection with default values): - EntraId-Hostname = login.microsoftonline.com (defaults to global cloud instance) - EntraId-TenantId = common (defaults to common endpoint that supports any tenant) - EntraId-OpenIdConfig = https://\<\<EntraId-Hostname\>\>/\<\<EntraId-TenantId\>\>/v2.0/.well-known/openid-configuration Collection Environment Variables (easily swappable for different environments): - EntraId-Hostname = login.microsoftonline.us (overrides global cloud instance with us gov instance) - EntraId-TenantId = mydomain.com (override with my tenant)
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#2123
No description provided.