mirror of
https://github.com/hoppscotch/hoppscotch.git
synced 2026-04-25 08:45:58 +03:00
[GH-ISSUE #5824] [feature]: Support Multiple Servers from OpenAPI Spec with Variable Generation #2282
Labels
No labels
CodeDay
a11y
browser limited
bug
bug fix
cli
core
critical
design
desktop
discussion
docker
documentation
duplicate
enterprise
feature
feature
fosshack
future
good first issue
hacktoberfest
help wanted
i18n
invalid
major
minor
need information
need testing
not applicable to hoppscotch
not reproducible
pull-request
question
refactor
resolved
sandbox
self-host
spam
stale
testmu
wip
wont fix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/hoppscotch#2282
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Leon-Luu on GitHub (Feb 2, 2026).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/5824
Is there an existing issue for this?
Summary
When importing an OpenAPI specification that contains multiple servers (e.g., for different environments like production, staging, and development), Hoppscotch currently only uses the first server URL and ignores the rest.
Current behavior in Hoppscotch:
Only https://api.example.com/v1 is used
Other server URLs are discarded
No way to easily switch between environments
Desired Behavior (Postman's Approach)
When Postman imports the same OpenAPI spec with multiple servers, it:
Generates a {{baseUrl}} variable automatically
Creates a collection variable with the first server as default value
Proposed Solution for Hoppscotch
Why should this be worked on?
@Leon-Luu commented on GitHub (Feb 2, 2026):
Adding a simple test openapi spec if anyone would like to test:
@ANKANJAGTAP commented on GitHub (Feb 3, 2026):
Hi
I’d like to work on this feature if it’s not already being handled.
Is the proposed approach (generating an environment/base URL variable from multiple OpenAPI servers) acceptable?
Happy to open a PR once aligned.
@ameduza commented on GitHub (Feb 11, 2026):
Hi, I bumped into the similar issue during the product review from my side. In my case I don't have several servers defined in OpenApi spec. Instead, I have separate spec for every environment like dev/qa/uat...
When I import any spec with Postman it performs two useful update:
baseUrlvariable on a collection level with the initial value form the spec. Normally I update it with the variable from my Globals, with the value depended on the selected environment DEV/QA/UAT...See the screen below with these steps. For my organization that is a real impediment for the migration from Postman as we have a number of APIs we are working on and import them from OpenApi specs from time to time. Switch between environments is crucial for us.
@ReK42 commented on GitHub (Feb 11, 2026):
For a practical example, look at the OpenAPI spec files for Matrix in
openapi-artifact.zip: https://github.com/matrix-org/matrix-spec/releases/latestFor example, the client/server API spec is:
When importing to Hoppscotch as-is, only the first server URL of
https://matrix.orgis available.Additionally, if I delete that first server entry so it imports the second entry,
{homeserver_address}is not recognized as a variable and used as a literal string. This results in all paths being, for example, the static stringhttps://{homeserver_address}/.well-known/matrix/client