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)
We'd love your help in making this extension even better! Here are some ways you can contribute:
Be sure to provide clear steps to reproduce the issue, along with any error messages or screenshots.
We appreciate any help you can provide!
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"
}
},
"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."
}
}
}
{
"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 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
dev-local
vsce package && code --install-extension ./*.vsix