swaggomnia

command module
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 16, 2025 License: MIT Imports: 19 Imported by: 0

README

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

Configuration Format

[!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/

  1. go install github.com/go-bindata/go-bindata/...@latest
  2. make some changes to tmpl/swagger.yaml
  3. 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

Documentation

Overview

Code generated for package main by go-bindata DO NOT EDIT. (@generated) sources: tmpl/swagger.yaml

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL