New Insomnia (v4) format causes app to crash
EnilPajic opened this issue · 7 comments
Expected behavior
To generate a swagger.json
file.
Current behavior
Application crashes with stacktrace:
./swaggymnia generate -insomnia httpbin.json -c config.json -o json
panic: assignment to entry in nil map
goroutine 1 [running]:
main.parse(0xc420012af0, 0x6, 0x4, 0xed4622342, 0x27290640, 0x0, 0xc42000ac40, 0x1b, 0xc420084580, 0x4, ...)
C:/Users/Mohamed/go/src/github.com/mlabouardy/swaggymnia/swagger.go:51 +0x32c
main.(*Swagger).Generate(0xc4200d37d8, 0x7ffeefbffaa8, 0xc, 0x7ffeefbffab8, 0xb, 0x7ffeefbffac7, 0x4)
C:/Users/Mohamed/go/src/github.com/mlabouardy/swaggymnia/swagger.go:83 +0x11f
main.main.func1(0xc420080840, 0x10100, 0xc420080840)
C:/Users/Mohamed/go/src/github.com/mlabouardy/swaggymnia/app.go:57 +0x180
github.com/urfave/cli.HandleAction(0x11bd260, 0x12080d8, 0xc420080840, 0xc42006a300, 0x0)
C:/Users/Mohamed/go/src/github.com/urfave/cli/app.go:502 +0xd4
github.com/urfave/cli.Command.Run(0x11fab4d, 0x8, 0x0, 0x0, 0xc420012880, 0x1, 0x1, 0x1202246, 0x1e, 0x0, ...)
C:/Users/Mohamed/go/src/github.com/urfave/cli/command.go:210 +0xb87
github.com/urfave/cli.(*App).Run(0xc4200c01c0, 0xc42000e080, 0x8, 0x8, 0x0, 0x0)
C:/Users/Mohamed/go/src/github.com/urfave/cli/app.go:259 +0x7b7
main.main()
C:/Users/Mohamed/go/src/github.com/mlabouardy/swaggymnia/app.go:66 +0x515
config.json
is simple:
{
"title" : "REST",
"version" : "0.0.0-rest",
"host" : "test.server.com",
"basePath" : "/api/",
"schemes" : "HTTP protocol",
"description" : "API test"
}
And my httpbin.json
is exported from Insomnia (for testing purpose, only one request is used, request is curl -X GET "https://httpbin.org/get" -H "accept: application/json"
):
{
"_type": "export",
"__export_format": 4,
"__export_date": "2019-05-06T12:44:50.657Z",
"__export_source": "insomnia.desktop.app:v6.4.1",
"resources": [
{
"_id": "req_cd668ad743b84a53a3f7484ffe285abe",
"authentication": {},
"body": {},
"created": 1557146662559,
"description": "",
"headers": [
{
"name": "accept",
"value": "application/json"
}
],
"isPrivate": false,
"metaSortKey": -1557146662559,
"method": "GET",
"modified": 1557146664393,
"name": "HttpBin",
"parameters": [],
"parentId": "wrk_7766cf26944f4d9d84e2183cfb9496cc",
"settingDisableRenderRequestBody": false,
"settingEncodeUrl": true,
"settingMaxTimelineDataSize": 1000,
"settingRebuildPath": true,
"settingSendCookies": true,
"settingStoreCookies": true,
"url": "https://httpbin.org/get",
"_type": "request"
},
{
"_id": "wrk_7766cf26944f4d9d84e2183cfb9496cc",
"created": 1557146654014,
"description": "",
"modified": 1557146654014,
"name": "Test.HttpBin",
"parentId": null,
"_type": "workspace"
},
{
"_id": "env_c65ad3eac00c7c67c9618d12ac830147f9913d21",
"color": null,
"created": 1557146654327,
"data": {},
"isPrivate": false,
"metaSortKey": 1557146654327,
"modified": 1557146654327,
"name": "Base Environment",
"parentId": "wrk_7766cf26944f4d9d84e2183cfb9496cc",
"_type": "environment"
},
{
"_id": "jar_c65ad3eac00c7c67c9618d12ac830147f9913d21",
"cookies": [],
"created": 1557146654334,
"modified": 1557146654334,
"name": "Default Jar",
"parentId": "wrk_7766cf26944f4d9d84e2183cfb9496cc",
"_type": "cookie_jar"
}
]
}
I'm using Insomnia 6.4.1 (6.4.1.2725)
for Mac (Mojave).
./swaggymnia --version
swaggymnia version 1.0.0-beta
Before Insomnia update, everything worked fine, but now Insomnia offers to export to
- Insomnia v4 json (one that I used)
- Insomnia v4 yaml
- HAR
and that (new) v4
format is not compatible with swaggymnia
anymore?
Steps to reproduce the behavior
- export workspace from insomnia (
Export data -> Insomnia v4 (JSON)
) - run
swaggymnia generate -i httpbin.json -c config.json -o json
- application crashes
Thank you in advance!
The maintainer does not seem responsive. Anybody know of an alternative way to convert insomnia json to swagger?
Still facing the issue. Do we have any work around or any previous version by which our work will not hamper?
Please check this ticket. I have updated the code and pushed a new version:
I will be creating a new repo for this since I have emailed him several times and gotten no response. I will assume its abandoned and will take it over
Ahh, the beauty of open source. Your fork works great.