JetClient / jet-client-support

JetClient is an advanced REST API Client plugin for JetBrains IDEs
https://plugins.jetbrains.com/plugin/21173-jetclient
110 stars 0 forks source link

OpenAPI Import file refresh #101

Closed mmuenker closed 3 months ago

mmuenker commented 3 months ago

Describe the bug

In order for changes made in selected OpenAPI files to take effect, it is necessary to restart the IDE.

Steps to reproduce

  1. Import requests from an OpenAPI file.
  2. Change the OpenAPI file
  3. Create a new draft request from a changed operation
  4. Changes in the OpenAPI file are not reflected in the new draft request
  5. Restart the IDE
  6. Create a new draft request from a changed operation
  7. Changes in the OpenAPI file are reflected in the new draft request

Expected behavior

The modifications made to the OpenAPI file should be reflected in the newly created drafts.

Environment information:

AntonShuvaev commented 3 months ago

Thanks for reporting this issue. The problem occurs because the parser reads the file from disk, and changes made in the editor are not saved immediately. I will fix this in the next version by ensuring changes are saved before importing the OpenAPI file. For now, you can manually save the file (Ctrl + S) to reflect the changes after a refresh.

mmuenker commented 3 months ago

Thanks for the quick response.

But I don't think that's the problem. The Open API file in question is generated, so the changes are saved to disk.

Is it possible that the plugin is using the IDE's file change detection? Maybe the IDE is not detecting the changes?

AntonShuvaev commented 3 months ago

Thanks for the feedback. It's possible to detect changes and automatically update the imported API whenever the OpenAPI file changes. However, this could impact performance when editing the OpenAPI file. For now, I'll keep the current behavior where you need to click the Refresh button in the tool window to update the imported API. As mentioned earlier, if you make changes to the OpenAPI file in the editor, you need to save those changes to disk (using 'Save All', switching editor tabs, etc.). Only then will the changes be applied when you click the Refresh button. I will fix this in the next version so that you will only need to click the Refresh button without having to save the file first. If you are making changes using a generation tool, the changes should be written to disk and should be applied after clicking the Refresh button. Did you try clicking the Refresh button in the tool window?

mmuenker commented 3 months ago

Understandable. Thank you.

Did you try clicking the Refresh button in the tool window?

No, I hadn't tried it before, but I gave it a try and it worked as I had expected. I'm not sure how I had overlooked the button previously ...