Generate Swagger Documentation from Insomnium REST Client (maintained fork of Fyb3roptik/swaggomnia)
Install
go install github.com/mrf345/swaggomnia@latest
How to use it
See usage with:
$ swaggomnia --help
Generate Swagger documentation:
$ swaggomnia generate -insomnia INSOMNIA_EXPORTED_FILE -config CONFIG_FILE -output FORMAT
| Option |
Description |
| -i |
Insomnia exported file |
| -c |
API Global Configuration file (see Configuration Format) |
| -o |
Insomnia output format (json or yaml, default yaml) |
Example
Let's convert the following Insomnia API documentation to Swagger:
$ swaggomnia generate -i examples/watchnow.json -c examples/config.json -o json
[!TIP]
security field is case-sensitive and only supports Bearer, Basic Auth, API Key.
{
"title" : "API Name",
"version" : "API version",
"basePath" : "https://api.domain.com/v1",
"description" : "API description",
"security": "Bearer"
}
Updating tmpl/
go install github.com/go-bindata/go-bindata/...@latest
- make some changes to
tmpl/swagger.yaml
go-bindata -o template.go tmpl/
Changes & TODOs
- enable request body string
- enable escaped resource description content (useful for showing code snippets)
- make query params optional by default
- hide empty groups
- add security definitions and options to config
- sort by group names instead of ids
- enable query params description
- enable and replace url path params
{% request 'parameter', 'id', 0 %} with {id}
- support multipart-form requests
- add more status codes conditioned by security and read/write method
- fix parameter default values
- add header descriptions and default values