rest-nvim / rest.nvim

A fast Neovim http client written in Lua
GNU General Public License v3.0
1.59k stars 142 forks source link

[Feature Request] Import Postman's JSON #144

Open c3n21 opened 2 years ago

c3n21 commented 2 years ago

Hello, and thanks a lot for this amazing plugin! I was wondering if you had the intention to add this feature to this plugin.

Postman allows you to export your queries and environments, and it would wonderful if rest.nvim could import them as well.

NTBBloodbath commented 2 years ago

Hey, I've never used postman before (I used to use Insomnia tho). Can you please provide some documentation about that feature?

Actually rest.nvim is able to import JSON files by using < /path/to/file.json syntax, it should be able to load JSON bodies exported by postman requests if that's what you're looking for.

Cheers!

c3n21 commented 2 years ago

Hey, I've never used postman before (I used to use Insomnia tho). Can you please provide some documentation about that feature?

Actually rest.nvim is able to import JSON files by using < /path/to/file.json syntax, it should be able to load JSON bodies exported by postman requests if that's what you're looking for.

Cheers!

If you mean that you can include a JSON file in the request body then that's not what I meant.

This is a reference for its collections JSON

https://schema.postman.com/collection/json/v2.1.0/draft-04/collection.json

AFAIK it's a set of pre-made requests that you can import inside Postman and run them.

You can also import "Environments" which essentially defines some variables that you can use inside your requests.

Here are some references:

https://learning.postman.com/docs/getting-started/importing-and-exporting-data/#exporting-environments

Btw, I've been digging around a while ago, and found this

https://github.com/postmanlabs/newman

A Postman (official) CLI version written in Node.

So I was thinking, instead of reinventing the wheel we could just write an adapter and wrap it inside rest.nvim, what do you think?

And more in general, we could also provide support for other external tools instead of just curl, but it could make the plugin more complex.

If you want to I could help you to write this adapter, but before digging in I want to know your opinion.

Obviously this feature should be optional, in the sense that users should not be obliged to install newman for rest.nvim to work.

NTBBloodbath commented 2 years ago

Hey, thank you for the explanation and all the information provided, very appreciated!

So I was thinking, instead of reinventing the wheel we could just write an adapter and wrap it inside rest.nvim, what do you think?

And more in general, we could also provide support for other external tools instead of just curl, but it could make the plugin more complex.

If you want to I could help you to write this adapter, but before digging in I want to know your opinion.

Actually I've been thinking about this kind of stuff lately. I was thinking about also adding support for curlie and other http clients for the terminal, so postman one could be added.

Increasing the plugin complexity doesn't mean make it harder to maintain if we retain a good codebase with easy to understand code whenever possible and take good design choices, also this would allow us to have a more flexible plugin that adapts to the needs and habits of the user.

Here are some notes before beginning with this:

I'll try to set up a matrix room or something like that for rest.nvim development later so we can also have a more natural convo about this kind of stuff, communication is very important :p

c3n21 commented 2 years ago

Hey, thank you for the explanation and all the information provided, very appreciated!

So I was thinking, instead of reinventing the wheel we could just write an adapter and wrap it inside rest.nvim, what do you think? And more in general, we could also provide support for other external tools instead of just curl, but it could make the plugin more complex. If you want to I could help you to write this adapter, but before digging in I want to know your opinion.

Actually I've been thinking about this kind of stuff lately. I was thinking about also adding support for curlie and other http clients for the terminal, so postman one could be added.

Increasing the plugin complexity doesn't mean make it harder to maintain if we retain a good codebase with easy to understand code whenever possible and take good design choices, also this would allow us to have a more flexible plugin that adapts to the needs and habits of the user.

Here are some notes before beginning with this:

* I'm doing an entire _incremental_ codebase rewrite and cleanup locally that I'll push to a new branch once I get something functional (at least the basics), so we have to wait until it's pushed. I'm constantly working on it!

* I'll keep cURL as the first-class citizen for rest.nvim as it's the most common terminal http client and it's usually available on all systems (at least the ones I've had experience with).

* Maybe we will want to make an internal API inside rest.nvim codebase so we can integrate other tools as add-ons, e.g. installing `rest-nvim/rest-postman.nvim` and adding it to rest.nvim setup as an integration will add postman to the available clients that can be used and then the user can also select that client on the setup function. Something similar to what nvim-cmp has with the completion sources.

I'll try to set up a matrix room or something like that for rest.nvim development later so we can also have a more natural convo about this kind of stuff, communication is very important :p

Sure! Ping me once you've done

NTBBloodbath commented 2 years ago

@c3n21 here's the matrix room link. I'll add it to README later too :p

c3n21 commented 2 years ago

@c3n21 here's the matrix room link. I'll add it to README later too :p

Right now I only have my phone, and it says that I'm not invited to this room 🥹

c3n21 commented 2 years ago

image

I'm having the same issue even on desktop.

You may want to add me right away, this is my profile

@c3n21:matrix.org

Ali-Aref commented 1 month ago

We really need this feature in this awesome plugin!