Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] No importers found for file (swagger 2.0) #1354

Closed
alxpsr opened this issue Jan 29, 2019 · 12 comments · Fixed by #1462
Closed

[Bug] No importers found for file (swagger 2.0) #1354

alxpsr opened this issue Jan 29, 2019 · 12 comments · Fixed by #1462

Comments

@alxpsr
Copy link

alxpsr commented Jan 29, 2019

  • 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?

@welcome
Copy link

welcome bot commented Jan 29, 2019

👋 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.

@gschier
Copy link
Contributor

gschier commented Feb 1, 2019

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

@alxpsr
Copy link
Author

alxpsr commented Feb 4, 2019

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"
                        ]
                    }
                ]
            }
        }
    }
}

@Tiberriver256
Copy link

Same here on the latest version

@WasserEsser
Copy link

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

@alxpsr
Copy link
Author

alxpsr commented Mar 13, 2019

any progress? 🙄

@dominik-lekse
Copy link

@Dracer5
Copy link

Dracer5 commented Apr 25, 2019

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

@gschier
Copy link
Contributor

gschier commented Apr 26, 2019

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.

@gschier
Copy link
Contributor

gschier commented Apr 26, 2019

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

@rmedaer
Copy link
Contributor

rmedaer commented May 22, 2019

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 ?

rmedaer added a commit to rmedaer/insomnia that referenced this issue May 22, 2019
@rmedaer
Copy link
Contributor

rmedaer commented May 22, 2019

Here is my patch for OpenAPI3: #1515

gschier pushed a commit that referenced this issue May 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants