molsonkiko / JsonToolsNppPlugin

A Notepad++ plugin providing tools for JSON like linting, querying, a tree view, and CSV conversion.
Apache License 2.0
94 stars 10 forks source link

[feature request] Save JSON API paths #32

Closed vinsworldcom closed 1 year ago

vinsworldcom commented 1 year ago

In the "JSON from file and APIs" form, it would be nice to remember - say the last 10 - "Get JSON from APIs" entries and have them auto-populated when the form opens.

image

I realize just populating that window would mean fetching them all (again) when pressing the "Send requests" button. I think it would be relatively easy to store in the config file up to 5 or 10 most-recently-used URLs. Just how to make them accessible in this window for each recall?

Cheers.

molsonkiko commented 1 year ago

Good idea! Probably a good way to do it is to store "sessions" (probably implemented as a JSON config file mapping session names to arrays of URLs). Since you're the first person to ask for anything related to the grepper form, I'd be curious if you can think of any other improvements I could make.

molsonkiko commented 1 year ago

The most recent commit implements this (minus the "sessions" feature, which doesn't feel like enough of a win to be worthwhile unless someone asks). Other ideas:

  1. maybe add configurable startup actions, like
    // grepperFormStartupActions.json
    {
    "query": "@.*[:]{foo: @.foo, len_bar: s_len(@.bar)}", // for each URL queried, get a JSON array, from which you select the foo attribute and the length of the bar attribute of each item
    "urls": [
        "https://foo.gov.api?user=bar",
        "https://foo.gov.api?user=baz",
    ]
    }
molsonkiko commented 1 year ago

I'd say the new implementation is a minimum viable product. I don't get the impression that this form is very widely used, and if someone is really unhappy with having to delete the URLs that auto-populate the field (unreasonable IMO because they can just Ctrl+A and then backspace), I might re-implement it in some other way. I'm open to suggestions.