mirror of
https://github.com/hoppscotch/hoppscotch.git
synced 2026-04-25 08:45:58 +03:00
[PR #5983] fix(common): merge path-level parameters in OpenAPI import #5449
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#5449
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/5983
Author: @mahmoodhamdi
Created: 3/13/2026
Status: 🔄 Open
Base:
main← Head:fix/openapi-path-level-params📝 Commits (1)
1b16706fix(common): merge path-level parameters in OpenAPI import📊 Changes
1 file changed (+25 additions, -18 deletions)
View changed files
📝
packages/hoppscotch-common/src/helpers/import-export/import/openapi/index.ts(+25 -18)📄 Description
What does this PR do?
Fixes the OpenAPI import to correctly handle path-level parameters. Previously, only operation-level parameters were being extracted, so endpoints like
/resource/{classUnitType}/{classUnitCode}would lose their path variables and render as/resource//after import.Why?
I was trying to import an OpenAPI 3.0 spec that had path parameters defined at the path item level (which is valid per the OpenAPI specification). All the path variables were missing from the imported requests — the URL showed empty segments instead of the variable placeholders.
In the OpenAPI spec, parameters can be defined both at the path item level (shared across all operations) and at the operation level (specific to GET, POST, etc.). The spec says operation-level parameters should override path-level ones with the same name and location.
Changes
convertPathToHoppReqsin the OpenAPI import helper to mergepathObj.parameters(path-level) withinfo.parameters(operation-level)Testing
/availabilityclassifications/<<classUnitType>>/<<classUnitCode>>with both variables inrequestVariables.Related Issues
Closes #5860
Summary by cubic
Fixes OpenAPI import in
hoppscotch-commonto merge path-level and operation-level parameters. Preserves path variables in endpoints, with operation-level params overriding path-level ones.pathObj.parameterswithinfo.parametersbefore parsing.requestVariables.Written for commit
1b1670671c. Summary will update on new commits.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.