Cannot import swagger 2.0 file anymore (it was working before updating to 7.2.2)

Hello,

I’m trying to import a swagger (yaml or json) file generate from my NSX-T manager.

I was able to import it without any issue, but since I updated postman to 7.2.2 I cannot import it anymore. I have little info in the logs:

[requester][error][“Swagger 2 ~ Failed to import Swagger 2.0”,“Error importing Swagger 2.0 spec”]

any idea what’s wrong?

many thanks

Eric

3 Likes

I am having the same error. But, oddly in v7.3.2 which is no longer on the website.

I am having the same issue on 7.2.2.

Error while importing Swagger 2.0: (Patchable parameter.type is mandatory for non-body parameters.

I reverted back to 7.2.0 and now it works. You can find the download here:

2 Likes

Hello Phil,

thank you very much. back to 7.2.0 and I was able to import the yaml again.

Eric

I am having the same issue. 7.2.2 won’t let me import swagger 2.0. It worked on the previous version. I upgraded to 7.3.4, but doesn’t work. And the download link for 7.2.0 is not there anymore, so… I can’t downgrade neither. currently I have no solution to import swagger 2.0 JSON file…

Hello,

I have downloaded the 7.2.0 you can find it here:
https://drive.google.com/open?id=1Em-n_OIbOpLBYVTno2iXlPtJfSbpxTRQ

hi Eric, you have Mac OS version by any chance :slight_smile: ?

check the same link I’ve uploaded the OSX version :wink:

The “Solution” should very much be considered a workaround. We shouldn’t have to be held back from the latest features/fixes. FWIW - I was getting a more generic import failure message and simply changed "swagger": "2.0" to "openapi": "2.0" and it worked. Seems hacky though

6 Likes

I am having this issue in the latest version v7.9.0
Can’t import swagger 2.0 json or yaml
https://www.weatherbit.io/static/swagger.json

Can’t find any logs on why it is failing. Swagger toolsets confirm the format is valid

Even I am getting a similar issue.

Error while importing Swagger 2.0: (Patchable) schema type must not be an array

I am using the latest version of POSTMAN: v7.13.0

Am I doing something wrong or it is a known bug?

Hey @larry.carson, have you tried the @sagomezmsft’s workaround?

simply changed "swagger": "2.0" to "openapi": "2.0" and it worked. Seems hacky though

It was nice to me and worked fine.

You should add to the beggining of json file next property: “openapi”: “3.0”
See example below:

    {
      "openapi": "3.0",
      "swagger": "2.0",
      "info": {
        "version": "v1",
        "title": "***"
    }

source: https://github.com/postmanlabs/openapi-to-postman/issues/24

2 Likes

I had the same problem when importing a YAML file in 7.16.0 and made the same change:

---
swagger: '2.0'
openapi: '3.0'
info:
....

And that made it work.

I’m on 7.16 as well, but adding openapi: '3.0' hasn’t helped:

“Error while importing Swagger 2.0: Could not import”… not an overly helpful error message.

UPDATE:
After further investigation, it looks to be related to using parameters:

"paths": {
  "/v1/thing/{id}": {
    "delete": {
      "description": "Delete thing.",
      "tags": [
        "<TAGS>"
      ],
      "parameters": [
        {
          "$ref": "#/parameters/<PARAM_NAME>"
        },
        {
          "in": "header",
          "name": "Auth-Type",
          "required": true,
          "type": "string",
          "enum": [
            "user"
          ]
        },
        {
          "in": "header",
          "name": "User-Id",
          "required": true,
          "type": "integer"
        }
      ],
      "responses": {
        "204": {
          "description": "Successful deletion of thing."
        },
        "401": {
          "description": "Not authenticated."
        },
        "403": {
          "description": "Not authorized."
        },
        "404": {
          "description": "Thing not found."
        },
        "500": {
          "description": "Thing gateway not supported."
        }
      }
    }
  }
},
"parameters": {
    "<NAME>": {
      "name": "id",
      "in": "path",
      "description": "My id.",
      "required": true,
      "type": "string"
    }
}

Like that hack mate! It worked for me on 7.24.0. Thanks!