149 support importing multiple collections at once#156
Conversation
0467c25 to
3d2e6c5
Compare
speziato
left a comment
There was a problem hiding this comment.
It looks good code-wise, but I want to discuss a bit the "implicit overwrite" approach.
Are we sure we want to implicitly overwrite an existing collection when importing? I get that the flow could get complicated, but I would not assume that users want to overwrite things.
An idea could be to place a "Overwrite existing collections" checkbox somewhere: if checked, it behaves as currently coded, otherwise we could present a simple modal with the list of ignored collections at the end of the import process.
What do you think?
Let me just note what we discussed in the call: this is a great idea to implement. Anyway we've refined this concept and in the next batch of commits, I'll introduce a way to inspect all errors occured during batch import. For each collection you will be able to choose whether or not to overwrite (this will then be reported in a table or something similar). |
Summary
This PR introduces batch collection import for all four supported formats (Postman, Bruno, OpenAPI/Swagger, and Solo), replacing the old single-file import API with a batch-first API on both the backend and the frontend.
Closes: #149
Description
Backend
Four new public
Appmethods replace the old single-import collection methods:The old single-file methods (
ImportPostmanCollection,ImportBrunoCollection,ImportOpenAPICollection,ImportSoloCollection) have been removed from the Wails surface.Batch orchestration lives in
internal/collection/batch_import.go. Each batch run:maxConcurrentCollectionImports = 4)UpdateCollectionA new
SelectFilesmethod was added alongside the existingSelectFileandSelectDirectory:The Bruno importer was also fixed in this PR:
params:queryandparams:pathDSL sections are now parsed correctly alongside the olderquerysectionparams:queryparams:pathare substituted directly into the URLFrontend
collectionImportStore.svelte.tswas migrated to the batch APIs. The pending import state changed from a singlepath: stringtopaths: string[]. Postman, OpenAPI, and Solo use the new multi-file picker; Bruno keeps the single-directory picker (multi-directory Bruno import is supported through drag-and-drop).After a batch completes, a summary notification is shown:
N collections importedN imported, M failed(first few per-item errors shown as separate toasts)Failed to import N collectionsLocalImportPane.sveltewas updated so theonImportcallback receivesdroppedPaths?: string[]instead of a single optional path. The display now shows the full path for one source andN sources selectedfor multiple. The component remains generic and shared with environment imports.EnvironmentManager.sveltewas updated to stay compatible with the newLocalImportPanecallback shape while preserving single-source environment import behavior (paths?.[0]). No batch environment import is introduced.CollectionList.sveltewires the new store shape: import disabled state checkspaths.length, drag-and-drop forwards all dropped paths to the store, and the old Solo overwrite modal was removed (Solo batch always overwrites).The environment manager modal was also fixed: the modal no longer opens fullscreen (was using
fullscreen+size="none"); it now usessize="xl"with a fixed body height, matching the Settings modal layout.Accepted limitations
OpenDirectoryDialogin Wails returns a single path; there is no multi-directory picker equivalent.BasePathandServersare not exposed in the batch result DTO. The OpenAPI importer already uses this metadata internally to compute the imported collection'sbaseUrlvariable; the frontend only needs per-item warnings.Breaking Changes
The following public
Appmethods have been removed from the Wails surface:ImportPostmanCollection(path string) errorImportBrunoCollection(path string) errorImportOpenAPICollection(path string) (OpenAPIImportCollectionResult, error)ImportSoloCollection(path string, overwrite bool) errorOpenAPIImportCollectionResulttypeCallers should use the new batch methods, passing a one-item path slice for single-source imports.
Tests performed 🧪
CollectionManager.ImportBatch: global errors (nil manager, empty paths), per-item failures (empty path string, import error, nil collection, save error), result ordering, warnings propagation, mixed success/failureparams:query,params:path, and URL deduplication coverage using a real Bruno collection fixturego test ./...passesgo build ./...passescd frontend && npm run formatpassescd frontend && npm run checkpasses (0 errors, 0 warnings)cd frontend && npm run lintpassescd frontend && npm run buildpassesLocalImportPanecallback shape change