Search code examples
jsonswaggerpostmandropwizardswagger-2.0

Unable to import swagger JSON or YAML into Postman


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


Solution

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