anil614sagar / openapi2apigee

OpenAPI to Apigee API Proxy using Node.js Utility
MIT License
33 stars 45 forks source link

Adding -B basepath option for proxy basepath #51

Closed diego-abarca closed 2 years ago

diego-abarca commented 2 years ago

https://github.com/anil614sagar/openapi2apigee/issues/7

By Adding -B or --basepath, a different basepath can be passed to the proxy, IE: /proxybasepath ---> /api/v1

ssvaidyanathan commented 2 years ago

@diego-abarca - Why would you want to change the basepath? Shouldnt this be coming from the spec itself?

diego-abarca commented 2 years ago

@ssvaidyanathan for cases when the proxy url basepath has to be different than the target url basePath

For example:

/dummy_development routes to --> development.dummyapi.com/api/v1 /dummy_production routes to --> www.dummyapi.com/api/v1 the spec basepath will be "/api/v1" but the proxy basepath will change depending on the user specified base path
ssvaidyanathan commented 2 years ago

Just to be clear --> The example you provided, are they the backend URLs? or the URLs of the proxy itself?

ssvaidyanathan commented 2 years ago

The code snippet suggest that you want to update the Apigee proxy basepath different from what is provided in the spec

For example the spec can have the basepath as /foo and instead of setting that you want to pass it as /bar

is that correct?

diego-abarca commented 2 years ago
/dummy_development routes will be the proxy URL, and traffic then will be redirected to development.dummyapi.com/api/v1; That's right, the spec can have as basepath /foo, but the proxy url basepath will be /bar, that way the proxy will be: **/foo**
ssvaidyanathan commented 2 years ago

But the code you have provided is updating the Proxyendpoint configuration. Its updates the Apigee proxy basepath to what ever pass in the argument. But what you are saying is updating the Target URL which should be in the TargetEndpoints

diego-abarca commented 2 years ago

Correct, that's the intention, the Target Endpoint will remain the same, will still be based on the spec, but the proxy endpoint can be modified to the value of the argument

diego-abarca commented 2 years ago

Hi, I've noticed that this PR is still open, is any extra information needed to merge or close? thanks

ssvaidyanathan commented 2 years ago

Fixed and released in v0.9.0 Sorry for the delay.