Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Insomnia to Swagger converterNew to Visual Studio Code? Get it now.
Insomnia to Swagger converter

Insomnia to Swagger converter

rslgp

|
1,599 installs
| (0) | Free
| Sponsor
Convert Insomnia collection JSON to swagger YAML openapi (postman compatible) make API documentation really easy, just using JSON-driven (no more trouble with openapi formatting)
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Insomnia to Swagger converter README

USAGE:

  • (tested on Insomnia 9.2.0 [help > about])
  • (optional) config Base Enviroment with our ENVS and REFS (check CONFIGURE INSOMNIA)
  • export collection from insomnia (v4 json) (if postman check FAQ)
  • open on vscode the collection in JSON
  • run command hotkey: ctrl + shift + P
  • type swagger
  • run command Convert insomnia (JSON) to swagger (YAML) openapi v3
  • save generated .yaml (you can preview using openapi 42crunch extension)

FAQ

not have collection json exported? on insomnia > enter collection > arrow down collection name > export > Insomnia v4 (JSON)

using postman? (Postman compatible) export collection > import on insomnia > GOTO [not have json exported]

Features

  • Auto generate swagger openapi v3 from insomnia collection.
  • Only need to use JSON format (no more OpenApi specifications details)
  • (optional, default enabled) includes automatic security auditing and defaults that can be customized only as needed

Requirements

  • configure Insomnia with our Base Enviroment
  • selected json of a collection exported from insomnia
  • use request settings description as a json to custom behavior

GUIDE: [config Base Enviroment ] click on gear on row (Manage Environments) > (+) plus button > shared enviroment > create ENVS and REFS (copy quick start below)

Reserved keywords tokens

  • $ENTITY (will be replaced to closest parent folder of request)
  • _$REF (alias to $ref if get trouble with $ref key on json)
  • _$PAGED (used to auto generate pagination)
  • request settings description:
"summary":{},
"responses": {
	"201": {
		"description": "$ENTITY creation sucess",
		"schema": {
			"$ref": "#/components/schemas/$ENTITY"
		}
	}
},
"request_example":{},
"response_example:{}

useful tips

  • (v0.21) you can use on query, path, body [USE $REF, example $ref1,$ref2 (includes $ref but differs on each others)] on insomnia this -> $ref:#/components/parameters/filter (or _$REF) to reuse ref component parameters (insomnia Base_ENV REFS > PARAMETERS > json)
  • if your exported file is very large, and nothing happens after the command, you may require to restart vscode window to work properly

COMMUNITY CONTRIBUTE:

We'd love your help in making this extension even better! Here are some ways you can contribute:

  • 🐞 Report Issues here

    Encounter any bugs or unexpected behavior?
    Please create an issue on our
    

    GitHub repository.

Be sure to provide clear steps to reproduce the issue, along with any error messages or screenshots.

We appreciate any help you can provide!

[REQUIRED] CONFIGURE INSOMNIA

ENVS

{
  "SecurityFixEnabled": true,
  "API_URL": "https://<<PRODUCTION_URL>>",
  "API_URL_LOCAL": "http://localhost:3000",
  "info": {
    "description": "api desc",
    "version": "1.0.0",
    "title": "api title",
    "contact": {
      "email": "author@gmail.com"
    }
  },
  "REGEX_INPUT":"^[a-zA-Z0-9- ]+$",
  "RESPONSES_TEMPLATE": {
    "200": {
      "description": "Success."
    },
    "400": {
      "description": "Missing params on request or validation error."
    },
    "401": {
      "description": "Access token is missing or invalid."
    },
    "403": {
      "description": "Forbidden."
    },
    "404": {
      "description": "Resource not found."
    },
    "406": {
      "description": "Not Acceptable."
    },
    "500": {
      "description": "Internal Error."
    }
  }
}

ENVS

REFS

{
  "REFS": {
    "COMPONENTS": {
      "SECURITYSCHEMES": {},
      "PARAMETERS": {},
      "RESPONSES": {},
      "SCHEMAS": {
        "MISSING_SECURITY": {
          "security_fix": true
        },
        "Pagination": {
          "limit": 1,
          "page": 1,
          "count": 0,
          "results": ["GENERIC ITEMS, from child components (allOf)"]
        },
        "EntityExample": {
          "column1": true
        }
      }
    }
  }
}

Entity description config

Entity folder structure CRUD

	ENTITY FOLDER
	--> GET request
	--> POST request

on request description (request > arrow down > settings > write) you can use a json

{
  "responses": {
    "201": {
      "description": "$ENTITY creation sucess",
      "schema": {
        "$ref": "#/components/schemas/$ENTITY"
      }
    }
  },
	"request_example":{
		"$ref": "#/components/schemas/$ENTITY"
	}
}

Release Notes

1.0.0

done

1.0.1

(not yet) Fixed issue #.

1.1.0

(not yet) Added features X, Y, and Z.


LICENSE

This extension is licensed under the MIT License

Sponsor

ko-fi

dev-local

vsce package && code --install-extension ./*.vsix

help > toggle developer tools (next to about)
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft