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

Import requests document from postman collection. #671

Draft
wants to merge 19 commits into
base: master
Choose a base branch
from

Conversation

rafek1241
Copy link

As in the topic, I've created implementation to automatically import postman collection to the vscode by creating virtual document with HTTP requests within it exactly in a postman format.
Currently unsupported:

  • authorization-specific settings from postman collection.

I wanted to share it with you early so you can give me your feedback.
I want to restructure this code soon. I want to create a resolver class that will be the factory for the option-specific importers.

Next steps:

Anyway - if we make good work there then we can receive really nice way to import many things using the good stuff that postmanlabs team delivers. The license is an apache 2.0 so I don't know if that is a problem or not..

Demo:

1

Robert Szachnowski added 12 commits August 19, 2020 22:33
Accept PostmanCollection in import parameter
In this commit I changed the way of creating
requests to set request-specific parameters
as rest client variables with request specific names.
In this way I prevent from duplications and ensure
that there will be no variables missing.
Additionaly if postman had some query string
variables set - I add those in HTTP url.
@lgtm-com
Copy link

lgtm-com bot commented Aug 27, 2020

This pull request introduces 1 alert when merging ed46bea into 2606ed6 - view on LGTM.com

new alerts:

  • 1 for Expression has no effect

Robert Szachnowski added 2 commits August 31, 2020 20:29
Refactor import controller to be easier to catch up.
Create IAmImporter interface that will be contract for each importer.
Move resolving file content to each specific importer implementation.
@rafek1241
Copy link
Author

Refactored the code to be easier to read and only authorization settings parser left.

Robert Szachnowski added 4 commits September 5, 2020 17:49
Refactoring make the importing less error-prone.
I wanted to achieve the situation where really simple and
on the first side uncompleted collection
would be parsed anyway in the state it is.
I saw also that collections in many situations are throwing when some data
aren't filled. Additional thing was importer utilities - it wasn't really
helpful and it didn't solve the multi-line comments in a good way. I
decided to change it to contains prefix for all the lines.
@lgtm-com
Copy link

lgtm-com bot commented Sep 5, 2020

This pull request introduces 2 alerts when merging 96c05ac into 9f5412e - view on LGTM.com

new alerts:

  • 1 for Unreachable statement
  • 1 for Expression has no effect

Implement authorization parser.
Remove redundant marks after return statement.
@rafek1241
Copy link
Author

rafek1241 commented Sep 8, 2020

Update:
I made authorization parsing but it's not tested yet (It is tested but not for the request that has it's own authorization within a group(folder) that has another one) and the code is a bit rusty.
Work to do:

  • Test authorization parsing (within request, group, document)
  • Refactor code within authorization parser.
  • Add documentation about importing in readme.md.

@ArmindoMaurits
Copy link

Did you ever manage to complete this feature @rafek1241 ?

@rafek1241
Copy link
Author

@ArmindoMaurits
Unfortunately no, but the feature is there, as you see. Feel free to continue this if you want. If you want, you can build extension from this branch and it will work for most scenarios for postman collections

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants