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 ] Add proxy support for the generate from template command #1621

Closed
2 tasks done
AayushSaini101 opened this issue Jan 10, 2025 · 13 comments · Fixed by #1665 · May be fixed by #1622
Closed
2 tasks done

[ Feature ] Add proxy support for the generate from template command #1621

AayushSaini101 opened this issue Jan 10, 2025 · 13 comments · Fixed by #1665 · May be fixed by #1622
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@AayushSaini101
Copy link
Collaborator

Why do we need this improvement?

We have already introduced proxy support in multiple commands of cli, reference: #1608 Need to add support in generate command as well.

How will this change help?

we can use the generate command behind the proxy as well.

Screenshots

No response

How could it be implemented/designed?

Reference:https://www.zenrows.com/blog/node-fetch-proxy#how-to-use-proxy-with-node-fetch of the implementation flow of the proxy

🚧 Breaking changes

No

👀 Have you checked for similar open issues?

  • I checked and didn't find a similar issue

🏢 Have you read the Contributing Guidelines?

Are you willing to work on this issue?

No, someone else can work on it.

@AayushSaini101 AayushSaini101 added enhancement New feature or request good first issue Good for newcomers labels Jan 10, 2025
@github-project-automation github-project-automation bot moved this to To Triage in CLI - Kanban Jan 10, 2025
@IITI-tushar
Copy link

IITI-tushar commented Jan 10, 2025

@AayushSaini101 I want to work on it... Please assign me.

@AayushSaini101
Copy link
Collaborator Author

@AayushSaini101 I want to work on it... Please assign me.

@IITI-tushar sure

@IITI-tushar
Copy link

Thanks, I will open a PR soon.

@cs7-shrey
Copy link

cs7-shrey commented Jan 10, 2025

can I too work on this? @AayushSaini101

@IITI-tushar
Copy link

IITI-tushar commented Jan 10, 2025

@AayushSaini101 in commands/generate folder should i have to add proxy support to all three fromTemplate.ts , index.ts and models.ts files ???

@AayushSaini101
Copy link
Collaborator Author

@AayushSaini101 in commands/generate folder should i have to add proxy support to all three fromTemplate.ts , index.ts and models.ts files ???
yes, understand the flow whenever they are seeking to URL particular URL, you need to configure proxy support

@AayushSaini101
Copy link
Collaborator Author

can I too work on this? @AayushSaini101

@IITI-tushar already working on this issue : )

@neoandmatrix
Copy link
Contributor

@AayushSaini101 looks like the pr has been inactive for quite some time. Can i continue with this issue.

Thanks.

@AayushSaini101
Copy link
Collaborator Author

@AayushSaini101 looks like the pr has been inactive for quite some time. Can i continue with this issue.

Thanks.

sure please thanks @neoandmatrix

@neoandmatrix
Copy link
Contributor

@AayushSaini101 looks like the pr has been inactive for quite some time. Can i continue with this issue.

Thanks.

sure please thanks @neoandmatrix

Thanks on it now.

@neoandmatrix
Copy link
Contributor

@AayushSaini101 while implementing this feature for the generate command i was going through the already implemented proxy support for asyncapi validate [SPEC-FILE] [PROXYHOST] [PROXYPORT] command but found some issues.

proxyPort and proxyHost can be passed from both arguments to command and from flags but is being read only from flags as implemented in code below

Image

This can be also confirmed from running the command.

Image

both command should output similar error but using flag gives correct error Proxy Connection Error: Unable to establish a connection to the proxy check hostName or PortNumber where as using as arguments give different error as FetchError: request to http://localhost:8080/dummySpec.yml failed, reason: connect ECONNREFUSED ::1:8080.

I guess the implementation should only be for flags as it makes more sense because passing with flags is a more cleaner implementation in my opinion.

I also might be mis understanding the implementation of this feature if that is the case please correct, will be very helpful.

So i wanted to ask that for this command should i go with arguments or flags method.

Please clarify so that i can proceed with implementation of this feature.

Thanks.

@AayushSaini101
Copy link
Collaborator Author

@AayushSaini101 while implementing this feature for the generate command i was going through the already implemented proxy support for asyncapi validate [SPEC-FILE] [PROXYHOST] [PROXYPORT] command but found some issues.

proxyPort and proxyHost can be passed from both arguments to command and from flags but is being read only from flags as implemented in code below

Image

This can be also confirmed from running the command.

Image

both command should output similar error but using flag gives correct error Proxy Connection Error: Unable to establish a connection to the proxy check hostName or PortNumber where as using as arguments give different error as FetchError: request to http://localhost:8080/dummySpec.yml failed, reason: connect ECONNREFUSED ::1:8080.

I guess the implementation should only be for flags as it makes more sense because passing with flags is a more cleaner implementation in my opinion.

I also might be mis understanding the implementation of this feature if that is the case please correct, will be very helpful.

So i wanted to ask that for this command should i go with arguments or flags method.

Please clarify so that i can proceed with implementation of this feature.

Thanks.

@neoandmatrix yes we are using flags in the existing commands

@github-project-automation github-project-automation bot moved this from To Triage to Done in CLI - Kanban Feb 15, 2025
@neoandmatrix
Copy link
Contributor

@AayushSaini101 should i also make the changes for existing commands and remove the proxyHost and proxyPort form arguments as it can be misleading to users by opening a new issue for this and making a PR there?

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
Archived in project
4 participants