Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Import Postman's JSON #144

Open
c3n21 opened this issue Oct 25, 2022 · 8 comments
Open

[Feature Request] Import Postman's JSON #144

c3n21 opened this issue Oct 25, 2022 · 8 comments
Labels
format-compat Import/export related issues, or how to interface with other tools

Comments

@c3n21
Copy link

c3n21 commented Oct 25, 2022

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
Copy link
Member

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
Copy link
Author

c3n21 commented Oct 27, 2022

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
Copy link
Member

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

@c3n21
Copy link
Author

c3n21 commented Oct 28, 2022

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
Copy link
Member

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

@c3n21
Copy link
Author

c3n21 commented Oct 29, 2022

@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
Copy link
Author

c3n21 commented Oct 29, 2022

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

@teto teto added the format-compat Import/export related issues, or how to interface with other tools label Dec 14, 2022
@Ali-Aref
Copy link

We really need this feature in this awesome plugin!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
format-compat Import/export related issues, or how to interface with other tools
Projects
None yet
Development

No branches or pull requests

4 participants