Collections imported from Postman use incorrect syntax for environment variables
- Dominant language
- TypeScript
- Stars
- 40k
- Forks
- 2.4k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 61
Description
### Expected Behavior
When I import a Postman collection into Insomnia, I would like it to work without any further modifications. Unfortunately, this is not possible since none of the variables can be resolved afterward.
### Actual Behavior
Postman uses the syntax `{{my-variable}}` to reference variables from the environment. This is imported into Insomnia as is but Insomnia would actually require `{{ _['my-variable'] }}` to correctly reference a variable from an environment in Insomnia.
The imported request:
Details about the variable using in the URL:
The way Insomnia can use the variable:
If I export the new Insomnia collection again, the JSON shows the two different syntax variants:
```json
{
"_type": "export",
"__export_format": 4,
"__export_date": "2023-07-27T05:42:24.205Z",
"__export_source": "insomnia.desktop.app:v2023.4.0",
"resources": [
{
"_id": "req_d14ba894132946e38504cc06db32ceb0",
"parentId": "fld_957c215ce3c54ecb956087081a47ecdb",
"modified": 1690436504823,
"created": 1690436253238,
"url": "{{ _['config-base-url'] }}/:applicationName/:profile",
"name": "Get Default Service Configuration",
"description": "",
"method": "GET",
"body": {},
"parameters": [],
"headers": [],
"authentication": {},
"metaSortKey": -1690436253238,
"isPrivate": false,
"settingStoreCookies": true,
"settingSendCookies": true,
"settingDisableRenderRequestBody": false,
"settingEncodeUrl": true,
"settingRebuildPath": true,
"settingFollowRedirects": "global",
"_type": "request"
},
...
{
"_id": "req_61ae16d74eda4caea60cc69a4e60712c",
"parentId": "fld_957c215ce3c54ecb956087081a47ecdb",
"modified": 1690436253238,
"created": 1690436253238,
"url": "{{config-base-url}}/:applicationName/:profile/:label",
"name": "Get Service Configuration with Label",
"description": "",
"method": "GET",
"body": {},
"parameters": [],
"headers": [],
"authentication": {},
"metaSortKey": -1690436253238,
"isPrivate": false,
"settingStoreCookies": true,
"settingSendCookies": true,
"settingDisableRenderRequestBody": false,
"settingEncodeUrl": true,
"settingRebuildPath": true,
"settingFollowRedirects": "global",
"_type": "request"
},
...
]
}
```
P.S.: Also note how Postman supported path parameters (variables in the path) like `:applicationName` and `:profile` which are not understood by Insomnia as such.
### Reproduction Steps
1. On the main screen, click on _+ Create_ and select _Import_
2. Choose the file of a previously exported Postman collection using environment variables
3. Click _Scan_
4. Click _Import_ on the next screen
5. Open the collection in the imported workspace
### Is there an existing issue for this?
- [X] I have searched the [issue tracker](https://www.github.com/Kong/insomnia/issues) for this problem.
### Additional Information
_No response_
### Insomnia Version
2023.4.0
### What operating system are you using?
macOS
### Operating System Version
Ventura 13.4.1
### Installation method
homebrew
### Last Known Working Insomnia version
_No response_
Contributor guide
Research direction
Reproduce the problem through the documented Create → Import → Scan → Import flow using a Postman collection with environment and path variables. Start by examining how the imported collection represents {{my-variable}} and :applicationName; done means imported environment variables resolve in requests and supported Postman path parameters work without manual edits.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- postman, typescript
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100