1
votes

Problem

Unable to convert swagger 2.0 into a format which is being affected by Postman import functionality

Generated via /swagger.json|yaml

Swagger endpoint exposed via dropwizard jetty using swagger

  • swagger-core: 1.5.17
  • swagger-jaxrs: 1.5.17
  • swagger-jersey2-jaxrs: 1.5.17
  • swagger-models: 1.5.17

Attempts

Tried manually importing the JSON or YAML versions via the import screen

  • import file
  • import from link
  • paste raw text

Tried converting to different formats using: api-spec-converter and swagger2-postman-generator

Result

Error on import: Must contain an info object

Question

Has anyone managed to get around this issue allowing the import

2

2 Answers

6
votes

In Swagger 2.0 the info field is mandatory. Just add the following to your YAML root:

info:
  title: 'EmptyTitle'
  description: 'EmptyDescription'
  version: 0.1.0

Or like this if you have it in JSON format (in the root too):

"info": {
  "title": "EmptyTitle",
  "description": "EmptyDescription",
  "version": "0.1.0"
}

Hope it helped !

0
votes

Have you tried converting to Postman v2?

The swagger2-postman-generator you tried converts Swagger v2 to Postman v1. This one converts Swagger v2 to Postman v2: https://www.npmjs.com/package/swagger2-postman2-converter as used in this tutorial.