Proposal to update the Insomnia YAML format #7866
Replies: 5 comments 10 replies
-
@subnetmarco When I was touching this repo actively, what I had in mind in regards to "script" was to actually point to files instead of having the code hard coded in the yaml file. ## ...
scripts:
pre-request:
path: ${file(./prescript.ts):PATH}
lang: ts
version: ^5.4.4
after-response:
path: ${file(./afterscript.ts):PATH}
lang: ts
version: ^5.4.4
## ... This way we can achieve several benefits;
I am only bringing this up because this can benefit our Testing features as well far ahead of our competitor products. Currently the testing feature is limited and locks you in with javascript with mocha and chai. |
Beta Was this translation helpful? Give feedback.
-
Suggestion: For requests under folder, should we add one more hierarchy like:
Besides, since we support global environment now, If the environment using in requests are from global environment rather than collection level/folder level environment, shall we also export the accordingly global environment. |
Beta Was this translation helpful? Give feedback.
-
It might be great if it could also resolve some frequently asked questions such as:
|
Beta Was this translation helpful? Give feedback.
-
Update to support folders: type: collection.insomnia.rest/5.0
name: My Collection
description: |
This is a long description
meta:
id: 3fed4ff3-d737-49e3-a5f2-f17b0f3a01d2
created: 1724094380513
modified: 1724420259205
environments:
- Base Environment:
private: false
value:
hello: world
- Secret:
private: true
value:
apikey: XYZ
data:
- My Folder 1:
meta:
id: f7875eb2-2a0f-4b92-a27f-4f3baa924559
created: 1724094380513
description: |
This is a folder example
queryparams:
- pathparam:
value: ''
params:
- query1:
value: val1
description: |
This is val1
- query2:
value: val2
description: |
This is val2
body:
mimeType: multipart/form-data
params:
- hello:
value: world
scripts:
pre-request:
value: |
console.log("pre")
after-response:
value: |
console.log("after")
headers:
- Content-Type:
value: multipart/form-data
authentication:
basic:
username: user
password: pass
requests:
- Request 1:
..
- Request 2:
..
- New Request:
meta:
id: f7875eb2-2a0f-4b92-a27f-4f3baa924559
created: 1724094380513
method: POST
url: 'httpbin.org/post/:pathparam'
description: |
This is a parent description
queryparams:
- pathparam:
value: ''
params:
- query1:
value: val1
description: |
This is val1
- query2:
value: val2
description: |
This is val2
body:
mimeType: multipart/form-data
params:
- hello:
value: world
scripts:
pre-request:
value: |
console.log("pre")
after-response:
value: |
console.log("after")
headers:
- Content-Type:
value: multipart/form-data
authentication:
basic:
username: user
password: pass |
Beta Was this translation helpful? Give feedback.
-
More examples for other resources. Collectionstype: collection.insomnia.rest/5.0
name: My Collection
description: |
This is a long description
meta:
id: 3fed4ff3-d737-49e3-a5f2-f17b0f3a01d2
created: 1724094380513
modified: 1724420259205
environments:
- Base Environment:
private: false
value:
hello: world
- Secret:
private: true
value:
apikey: XYZ
data:
- My Folder 1:
meta:
id: f7875eb2-2a0f-4b92-a27f-4f3baa924559
created: 1724094380513
description: |
This is a folder example
queryparams:
- pathparam:
value: ''
params:
- query1:
value: val1
description: |
This is val1
- query2:
value: val2
description: |
This is val2
body:
mimeType: multipart/form-data
params:
- hello:
value: world
scripts:
pre-request:
value: |
console.log("pre")
after-response:
value: |
console.log("after")
headers:
- Content-Type:
value: multipart/form-data
authentication:
basic:
username: user
password: pass
requests:
- Request 1:
..
- Request 2:
..
- New Request:
meta:
id: f7875eb2-2a0f-4b92-a27f-4f3baa924559
created: 1724094380513
method: POST
url: 'httpbin.org/post/:pathparam'
description: |
This is a parent description
queryparams:
- pathparam:
value: ''
params:
- query1:
value: val1
description: |
This is val1
- query2:
value: val2
description: |
This is val2
body:
mimeType: multipart/form-data
params:
- hello:
value: world
scripts:
pre-request:
value: |
console.log("pre")
after-response:
value: |
console.log("after")
headers:
- Content-Type:
value: multipart/form-data
authentication:
basic:
username: user
password: pass Mocks:type: mock.insomnia.rest/5.0
name: My Mock
description: |
This is a long description
meta:
id: 3fed4ff3-d737-49e3-a5f2-f17b0f3a01d2
created: 1724094380513
modified: 1724420259205
data:
- Mock Route:
meta:
id: f7875eb2-2a0f-4b92-a27f-4f3baa924559
created: 1724094380513
method: POST
status: 200
body:
mimeType: application/json
value: |
{
"args": {},
"headers": {
"Accept": "*/*",
"Content-Length": "25",
"Content-Type": "multipart/form-data; boundary=X-INSOMNIA-BOUNDARY",
"Host": "httpbin.org",
"User-Agent": "insomnia/9.1.1",
"X-Amzn-Trace-Id": "Root=1-667fcd36-06fe9e7e521007577f6b2687"
},
"origin": "87.13.164.94",
"url": "http://httpbin.org/get"
}
headers:
- Content-Type:
value: multipart/form-data Environments:type: environment.insomnia.rest/5.0
name: My Global Environment
description: |
This is a long description
meta:
id: 3fed4ff3-d737-49e3-a5f2-f17b0f3a01d2
created: 1724094380513
modified: 1724420259205
data:
- Staging:
meta:
id: f7875eb2-2a0f-4b92-a27f-4f3baa924559
created: 1724094380513
color: #cccccc
private: true
value:
hello: world
this:
is:
a:
complex: "value" Design Documents:type: spec.insomnia.rest/5.0
name: My Design Spec
description: |
This is a long description
meta:
id: 3fed4ff3-d737-49e3-a5f2-f17b0f3a01d2
created: 1724094380513
modified: 1724420259205
data:
meta:
id: 3fed4ff3-d737-49e3-a5f2-f17b0f3a01d2
created: 1724094380513
modified: 1724420259205
name: my-spec.yaml
file: /to/path.yaml # If we have file, we cannot have spec and viceversa
spec:
openapi: 3.0.0
info:
description: "This is a sample server Petstore server. You can find out more about
Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net,
#swagger](http://swagger.io/irc/). For this sample, you can use the api key
'special-key' to test the authorization filters."
version: 1.0.2
title: Swagger Petstore
termsOfService: http://swagger.io/terms/
contact:
email: [email protected]
license:
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
...
collection: # Similar to standalone collection
meta:
id: 3fed4ff3-d737-49e3-a5f2-f17b0f3a01d2
created: 1724094380513
modified: 1724420259205
environments:
- Base Environment:
private: false
value:
hello: world
- Secret:
private: true
value:
apikey: XYZ
data:
.. |
Beta Was this translation helpful? Give feedback.
-
We are currently looking at ways to make Insomnia play nicer with Git and diff viewer tools, by simplifying its underlying YAML format. If there is any feedback or ideas, this would be the right time to start brainstorming on them.
Proposal
This is the new proposal, which is almost half the size of the current format:
Current legacy
And this is the current equivalent:
Principles
To improve readability:
false
boolean properties. Assume them to befalse
.meta
section is optional, if missing we will generate a newid
and newcreated
fields.Local, Git and Cloud
The new format can be used for all storage types.
Feedback?
This is a simple example of a collection format, the equivalent will also be created for design specs, mocks, and other file types.
Do you have any feedback?
Beta Was this translation helpful? Give feedback.
All reactions