http client: json payload autocomplete does not work when base path is defined as variable

已回答

The http client has a nice autocomplete feature for request payloads in json.

But when I replace the base path in the request URL with a variable, the autocomplete feature does not work anymore. I checked and the content of the variable is exactly what appears in the Swagger spec.

Is it a known bug?

 

Example in which autocomplete works:

POST https://{{api-host}}/my/base/path/resource
content-type: application/json
 

{}

 

Example in which autocomplete DOES NOT work:

POST https://{{api-host}}{{api-base-path}}/resource
content-type: application/json
 

{}

0

Hello, Fabiovh. Could you please specify where exactly you call autocompletion in the sample code you shared? 

0

sure, I press ctrl+space inside the {} in the request body.

if the variable {{api-base-path}} has no slashes, it works, but if it's a path with slashes then it does not

0

Thank you for the clarification. However, when trying to reproduce the issue on my side, I see the  No suggestions  popup in both cases. Could you please specify if something else is necessary to receive the correct popup? Should something be specified in the environment or in the project itself? Which exact IDE version do you use?

0

Yes, you need the API spec and the variables. I created a minimal example of the issue. Put the following 3 files in the same folder and you should be able to see it.

https://gist.github.com/fabiohecht/10428bfa704e1a712204f516f87d8c4e

https://gist.github.com/fabiohecht/5a1f7d70a5398af419e6045814442d78

https://gist.github.com/fabiohecht/66ca64cc7e342136eca6e62341cf26f7

Using IntelliJ IDEA 2023.2.2 (Ultimate Edition).

What I'm trying to achieve is that I can store the API host and base path as variables and autocomplete should work. In my specific case, the base path contains slashes and differs across environments.

0

Fabiovh, thank you for the detailed explanation. The problem is reproducible on my side, and I created a new bug report in our YouTrack. Please, feel free to upvote it to receive updates.

1

请先登录再写评论。