Insomnia: [Bug] No importers found for file (swagger 2.0)

Created on 29 Jan 2019  路  12Comments  路  Source: Kong/insomnia

  • Insomnia Version: 6.3.2
  • Operating System: windows 10_x64

Details

I'm trying to import my swagger.json into Insomnia, but got an error: No importers found for file. Swagger version is 2.0. What i'm doing wrong?

Most helpful comment

Same here on the latest version

All 12 comments

馃憢 Thanks for opening your first issue! If you're reporting a 馃悶 bug, please make sure
you include steps to reproduce it. If you're requesting a feature 馃巵, please provide real
use cases that would benefit. 馃應

To help make this a smooth process, please be sure you have first read the
contributing guidelines.

Can you post an example swagger.json that reproduces the problem?

Yes of course, @gschier

{
    "swagger": "2.0",
    "info": {
        "version": "v1",
        "title": "docs"
    },
    "paths": {
        "/api/list": {
            "get": {
                "tags": [
                    "Document"
                ],
                "summary": "Some list",
                "operationId": "ApiId",
                "consumes": [],
                "produces": [
                    "text/plain",
                    "application/json",
                    "text/json"
                ],
                "parameters": [],
                "responses": {
                    "200": {
                        "description": "Success",
                        "schema": {
                            "type": "array",
                            "items": {
                                "$ref": "#/definitions/Dto.Document.DocumetnDto"
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthorized"
                    },
                    "403": {
                        "description": "Forbidden"
                    }
                },
                "security": [
                    {
                        "Bearer": [
                            null,
                            "Role"
                        ]
                    }
                ]
            }
        }
    }
}

Same here on the latest version

We're facing the same issue. We have been supplied three swagger.json files and only one of them can get imported.

any progress? 馃檮

A lot of people experiencing with bug, me too. Will you provide further info?

Just took a look at this and it seems like $ref attributes are causing the issues.

@alxpsr's example file returns the following error:

Error resolving $ref pointer "/Users/gschier/Workspace/insomnia/desktop/packages/insomnia-app/#/definitions/Dto.Document.DocumetnDto". 
Token "definitions" does not exist.

@dominik-lekse's example returns the following error:

Error opening file "/Users/gschier/Workspace/insomnia/desktop/packages/insomnia-app/examples/ManagedClustersList.json" 
ENOENT: no such file or directory, open '/Users/gschier/Workspace/insomnia/desktop/packages/insomnia-app/examples/ManagedClustersList.json'

It looks like $refs are only for linking to documentation reference so there errors probably should be ignored. I just refactored the import module to try continuing if the Swagger validation fails. This should fix the problem I think.

Also, thank you @alxpsr and @dominik-lekse for the test case files. I've included @alxpsr's example in the test suite fixtures

I figured out that there is the same bug in OpenAPI importer (openapi3.js). Here is the output of my console:

openapi3.js?9a64:87 SyntaxError: Error resolving $ref pointer "/(...)/insomnia/packages/insomnia-app/#/components/schemas/api-version". 

I guess we could apply the same fix ?

Here is my patch for OpenAPI3: #1515

Was this page helpful?
0 / 5 - 0 ratings