mirror of
https://github.com/hoppscotch/hoppscotch.git
synced 2026-04-25 08:45:58 +03:00
[PR #5986] fix(import): include scheme in OpenAPI v2 base URL #5450
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#5450
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?
📋 Pull Request Information
Original PR: https://github.com/hoppscotch/hoppscotch/pull/5986
Author: @mahmoodhamdi
Created: 3/13/2026
Status: 🔄 Open
Base:
main← Head:fix/openapi-v2-scheme-in-url📝 Commits (3)
acbb172fix(import): include scheme in OpenAPI v2 base URLca5c6c5fix(import): avoid prefixing scheme to baseUrl placeholderc9859f8fix: use || for scheme fallback to handle empty strings📊 Changes
1 file changed (+4 additions, -2 deletions)
View changed files
📝
packages/hoppscotch-common/src/helpers/import-export/import/openapi/index.ts(+4 -2)📄 Description
Description
When importing Swagger 2.0 (OpenAPI v2) specifications, the base URL is currently built from only
hostandbasePath, completely ignoring theschemesarray. This produces URLs likeapi.example.com/v1instead ofhttps://api.example.com/v1.For example, given this Swagger 2.0 spec:
The importer currently generates:
petstore.swagger.io/v2Expected:
https://petstore.swagger.io/v2Changes
In
parseOpenAPIUrl, read the first entry fromdoc.schemes(falling back tohttpswhen the array is absent or empty) and prepend it to the constructed URL.Testing
hoppscotch-commonpassSummary by cubic
Include the scheme when constructing the base URL for Swagger 2.0 (OpenAPI v2) imports. Imported requests now use the correct protocol (e.g., https://petstore.swagger.io/v2).
schemesentry; fall back tohttpswhen the array is missing or the entry is empty.hostis missing, return<<baseUrl>>without a scheme to avoid double-scheme URLs after substitution.Written for commit
c9859f868e. Summary will update on new commits.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.