insomnia icon indicating copy to clipboard operation
insomnia copied to clipboard

Change Insomnia variables to path parameters in openapi import

Open SpechtD opened this issue 1 year ago • 3 comments

Feature Request

With the introduction of path parameters in version 8.6 it would be more fitting to convert path parameters in openapi format to insomnia path parameters with a colon, instead of insomnia variables with double curly brackets.

Current behavior

openapi: /foo/{bar} insomnia: /foo/{{_.$1}}

Wanted behavior

openapi: /foo/{bar} insomnia: /foo/:bar

Affected code

https://github.com/Kong/insomnia/blob/0ddbccfd3e8d010d3b769a8e562325a8e27ac006/packages/insomnia/src/utils/importers/importers/openapi-3.ts#L272-L278

If my proposal is welcomed, I will open a PR with the requested change myself.

SpechtD avatar Oct 03 '24 20:10 SpechtD

Colon led parameters would not be interpolated by nunjucks rendering. It uses brackets to identify syntax to evaluate.

jackkav avatar Oct 04 '24 06:10 jackkav

I'm not sure if I'm overlooking something here, but after changing this path?.replace(VARIABLE_SEARCH_VALUE, '{{ _.$1 }}') ?? '';

to this path?.replace(VARIABLE_SEARCH_VALUE, ':$1') ?? '';

it works:

grafik

A setting to control the behavior would probably be quite suitable, if some people prefer the old behavior, but in my use case it would be a welcomed change.

SpechtD avatar Oct 05 '24 22:10 SpechtD

I guess it's possible the question is can you make url and headers editable without causing bugs or side effects. @gatzjames what do you think?

jackkav avatar Oct 07 '24 08:10 jackkav

Have you got any updates on this?

SpechtD avatar Oct 27 '24 11:10 SpechtD

Any update here ? Just tried insomnia over postman and actually this seems to be the only thing that I use and is not in insomnia

MGREMY avatar Dec 09 '24 21:12 MGREMY

I really wish this feature could be implemented, that's also something I widely use and it is not on insomnia.

PoweredTable avatar Jul 22 '25 22:07 PoweredTable

I finished the PR and put it up for review @jackkav @gatzjames

SpechtD avatar Aug 29 '25 23:08 SpechtD