[Bug] Import collection failed: The Collection file is corrupted
I have checked the following:
- [X] I use the newest version of bruno.
- [X] I've searched existing issues and found nothing related to my issue.
Describe the bug
Bruno v1.13.1 running on Mac OS 14.4.1
Importing a collection which validates on https://editor.swagger.io/ gives the below error.
Unfortunately it gives no indication of what or where the incompatibility is.
.bru file to reproduce the bug
None available.
Screenshots/Live demo link
Same problem on Windows 10 - but I only get "Import collection failed". Opening the console mentions "The Collection file is corrupted", as well as this error:
ValidationError: this field has unspecified keys: type, ignore
Hello! I ran into the same problem. As a temporary fix, I manually updated my own collection (json) by following the validations errors in the console.
The chrome console is available in the same menu as the one to create/import collections. In my case there was a couple of validation errors on the type of my requests being invalid, as well as the query field being unspecified. I found the schema definitions here and here.
Specifically I had to:
- change
"type": "http"to"type": "http-request"for all the"request" - change
"query"to"params"
Hope this helps 🌈
Same issue here. To my case, as the console states - ValidationError: items[14].type must be one of the following values: http-request, graphql-request, folder, where in my case item[14] is sth. like below. It looks like certain 'describing' text. After i deleted it, the import can go on. (not sure any impact from this deletion, but at least the Import can proceed with most your data 'transferred')
// ... omitted
{
"type": "http"
...
},
{
"type": "folder"
...
},
{ // item[14]
"type": "json",
"name": "bruno",
"seq": 1
}
],
This could be a workaround before we get a formal fix :)
Same issue here. To my case, as the console states - ValidationError: items[14].type must be one of the following values: http-request, graphql-request, folder, where in my case item[14] is sth. like below. It looks like certain 'describing' text. After i deleted it, the import can go on. (not sure any impact from this deletion, but at least the Import can proceed with most your data 'transferred')
// ... omitted { "type": "http" ... }, { "type": "folder" ... }, { // item[14] "type": "json", "name": "bruno", "seq": 1 } ],This could be a workaround before we get a formal fix :)
This workaround did the job for me ✅
Still seems to be an issue in v1.16.1 as of 2024-06-05. I found a mix of agatheblues' and hmeng1024's solutions to be the workound for me. Replacing all the "type": "http" with "type": "http-request" and removing the "name": "bruno" entry from the items array allowed me to import the collection.
Hi All,
I had the same problem. I remove the below item and it worked for me. { "type": "json", "name": "bruno", "seq": 1 }, Other option is rename type "json" to "folder" Also Use the import option from the left menu. The import option on the main window does not work for me.
None of the workarounds seems to do anything with v1.20, I don't even have some of the fields being suggested (such as "type": "http" or "type": "json") in our OpenAPI spec:
Edit: updated to v1.20.2 (12353a3ad) and it also has the same issue
Hey @NiklasBr, could you please share the OpenAPI spec with all sensitive values redacted?
@sanjai0py api-doc.json
Running into a similar issue with 1.20.4, I'm getting Import collection failed: The Collection file is corrupted. In the console I see:
ValidationError: name must be at least 1 character
at createError (_app-1742de34df20b137.js:31:76737)
at _app-1742de34df20b137.js:31:77063
This is the spec file: openapi.json
Thanks
Updated from v1.20.2 to v1.23.1 but it still has the same problem @sanjai0py.
@niekcandaele I found info.title cannot be empty. The error display in the console was "name must be at least 1 character"
So I fixed the error by setting a title.
"info": {
"title": "Name of my collection",
"version": "1.0.0"
}
I'm on the 1.23.1 version.
And for @NiklasBr, I quickly check, and I found out that method cannot be "trace" verb. I think this is not supported by Bruno yet.
The message error is "items[10].request.method must be one of the following values: GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS"
I advice you to use the web console in bruno and enable the caugth on exception exception. To display the web console, go to View > Toggle Developper Tools. To stop on exception got to the tab Source then go to Breakpoint and check the option Pause on caught exceptions.
@niekcandaele I found
info.titlecannot be empty. The error display in the console was"name must be at least 1 character"So I fixed the error by setting a title.
"info": { "title": "Name of my collection", "version": "1.0.0" }I'm on the 1.23.1 version.
I still think that Bruno should be able to handle this more gracefully, this spec works with other tools.
This quick fix works for me though, thank you!
But TRACE is a valid request method, so why is Bruno throwing an exception?
With the release of Bruno v1.25.0, which includes the above fix, all my current technical issues with OpenAPI import has been resolved.