mirror of
https://github.com/hoppscotch/hoppscotch.git
synced 2026-04-26 01:06:00 +03:00
[GH-ISSUE #5073] [feature]: Improve Handling of Duplicate OpenAPI Spec Imports in Hoppscotch #1931
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#1931
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 (May 14, 2025).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/5073
Is there an existing issue for this?
Summary
Problem
Currently, when importing the same OpenAPI specification multiple times in Hoppscotch, the app creates new collections with the same name, based solely on info.title. This leads to confusion and clutter, making it difficult for users to identify the latest or relevant version of the imported spec.
Example:
1st import: "OpenAPI Petstore"
2nd import (same file or version): "OpenAPI Petstore"
3rd import (new version or not): "OpenAPI Petstore"
There is no indication of version, and no safeguards to avoid duplicates or to help the user track versions clearly.
✅ Proposed Solution
When importing an OpenAPI spec:
Check if a collection with the same info.title already exists.
If no collection with the same title exists, proceed with info.title as the collection name (current behavior).
If a collection with the same title exists, enhance naming based on the version from info.version.
Suggested Naming Behavior:
=> First import:
Collection: OpenAPI Petstore
=> Second import of same version (3.0.0):
Option A (default): OpenAPI Petstore[3.0.0]
Option B (if already exists): OpenAPI Petstore[3.0.0] copy
Optional behavior: prompt to overwrite or create copy.
=> Third import with new version (3.0.1):
Collection: OpenAPI Petstore[3.0.1]
Why should this be worked on?
Improves User Experience:
Users frequently re-import updated OpenAPI specs as their APIs evolve. Adding version-aware naming will help users clearly differentiate between versions and reduce accidental usage of outdated collections.
Reduces Clutter & Confusion:
Without unique or versioned names, users may struggle to know which imported collection corresponds to the latest or correct spec, especially in collaborative or long-term projects.
Aligns with Common API Tooling Practices:
Tools like Postman and SwaggerHub already support version tagging or naming differentiation. Bringing this behavior to Hoppscotch will align it with user expectations and best practices.
Scales Better for Teams and CI Pipelines:
In automated or team workflows, the ability to track and overwrite specific versions avoids unnecessary duplication and helps maintain clarity and consistency across environments.
@Leon-Luu commented on GitHub (May 15, 2025):
I had created pull request to fix this issue: https://github.com/hoppscotch/hoppscotch/pull/5078
@Leon-Luu commented on GitHub (May 15, 2025):
Hello @AndrewBastin what do you think about this?