Kong / Kong/insomnia

Design Document debugging does not use OpenAPI example path parameters

Open
#5,924 0 comments 0 reactions 0 assignees View on GitHub
B-bug S-unverified
Dominant language
TypeScript
Stars
40k
Forks
2.4k
Avg merge
2d 13h
Merged PRs (30d)
61

Description

### Expected Behavior

When defining a path within an OpenAPI document, it is possible to provide example values for in path parameters. When debugging within an Insomnia design document, if such a example path parameter value is provided, it should be added to the path of the url.

This behavior would be more useful when defining OpenAPI documents that can then be shared amongst a development team, without having to rely on values being stored within insomnia environment variables.

This behavior would also match how the OpenAPI `Try it out` functionality uses such example path values, as can be seen on the right of the below screenshot:

![Path-param-example01](https://user-images.githubusercontent.com/19207995/234921806-d7100417-603c-453f-b1b6-01417f6ff5a7.png)

### Actual Behavior

The Insomnia design document debug screen treats path parameters as Insomnia environment variables, and ignores any example path parameter values that are specified in the corresponding OpenAPI document. Instead the path parameter appears as an errored variable in the debug path, with the error `attempted to output null or undefined value`.

![Path-param-example02](https://user-images.githubusercontent.com/19207995/234920538-9398ab1b-d2ed-4767-8455-4b75a76a648f.png)

### Reproduction Steps

Use the following OpenAPI specification to create a new Design Document. Then generate a request collection from it to see the issue described above.

[JSONPlaceholderExample.yaml.txt](https://github.com/Kong/insomnia/files/11345878/JSONPlaceholderExample.yaml.txt)

### 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

It is possible to alter the value of a path parameter after the request collection has been generated, and this is value is then kept when exporting the design document. However this feels less intuitive than using examples values provided in the corresponding OpenAPI document.

### Insomnia Version

2023.2.0

### What operating system are you using?

Windows

### Operating System Version

Windows 10 version 10.0.19044

### Installation method

insomnia.rest

### Last Known Working Insomnia version

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by importing the linked JSONPlaceholderExample.yaml.txt OpenAPI specification into an Insomnia Design Document and reproducing the debug request with an example path parameter. Trace how the design document debug screen resolves path parameters; done means the example value is inserted into the URL instead of being treated as a missing Insomnia environment variable.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi, typescript
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.