insomnia-plugin-export-to-openapi
v1.0.6
Published
Exports an Insomnia collection to OpenAPI 3.0 YAML format, preserving the folder structure as tags.
Downloads
312
Maintainers
Readme
Key Features
- One-Click Export: Adds a simple "Export to OpenAPI 3.0" option to your workspace menu.
- Preserves Folder Structure: Automatically converts your Insomnia request folders and sub-folders into OpenAPI
tags, keeping your documentation organized just like your collection. - OpenAPI 3.0 Compliant: Generates a valid OpenAPI 3.0 specification in YAML format.
- Handles Various Request Types: Correctly processes path parameters, query parameters, and request bodies for
application/x-www-form-urlencoded,multipart/form-data, and more. - User-Friendly: Prompts you to choose a save location for the exported file.
Installation
- Open Insomnia.
- Go to Application > Preferences > Plugins.
- Type
insomnia-plugin-export-to-openapiand click Install Plugin. - That's it! No configuration is needed.
Usage
- Click on your collection/workspace name in the top-left corner of Insomnia.
- From the dropdown menu, select Export to OpenAPI 3.0.
- A "Save As" dialog will appear. Choose a name and location for your
openapi.yamlfile. - Click Save. A confirmation alert will appear upon successful export.
The resulting YAML file can be used with any tool that supports the OpenAPI specification, such as Swagger UI, Redoc, or Postman.
How It Works
This plugin hooks into Insomnia's workspace actions. When triggered, it:
- Reads the entire data model of the current workspace, including requests, request groups (folders), and environments.
- Recursively processes the folder structure, mapping each folder to an OpenAPI tag.
- Iterates through each request, converting its URL, method, parameters, and body into the corresponding OpenAPI path operation object.
- Bundles everything into a valid OpenAPI 3.0 specification.
- Uses
js-yamlto serialize the final object into a clean YAML string.
Contributing
Contributions are welcome! If you have a suggestion or find a bug, please feel free to:
- Open an issue on the GitHub repository.
- Fork the repository and submit a pull request.
License
This project is licensed under the MIT License - see the LICENSE.md file for details.
