-
Notifications
You must be signed in to change notification settings - Fork 123
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
✨ add support for top level variables #493
Conversation
Can you please elaborate on the change? |
Codecov Report
@@ Coverage Diff @@
## develop #493 +/- ##
========================================
Coverage 93.83% 93.83%
========================================
Files 9 9
Lines 454 454
========================================
Hits 426 426
Misses 28 28 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Thanks for the comment, I already edited the pr's comment |
Maybe I don't fully understand, but to me this solution sounds like a hack and I'm not sure that it's the responsibility of Chopper to give the user the option of having multiple environments. Why not simply abstract all these final ChopperClient client = ChopperClient(
baseUrl: prodEnv.apiUrl // <--
// ... stuff
); Sorry if I'm being too nosy, but can you maybe provide a few examples? |
i updated the comment again with an example, no problem bro |
I've cleaned it up for you :) I see what you mean. I'd usually solve this using a Right, can you add some tests for this, then I think we can merge it :) |
ready man i upload some tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this addition doesn't do any harm. It doesn't directly change the way how some one would use chopper. Maybe a bit more documentation could be added in the doc files. So its not really a "hidden" feature. Although I think I would have solved this by rewriting baseUrl in a Interceptor. If I had to change thinks runtime. |
I created this pr to give support to top level variables for the scenarios where we have multiple urls and that urls depend on ambient. for example we have our service A to make the main requests but we have service B to specific funcionality with diferent base url and maybe we want to change the service B to a dev version, so to change the url we have tu rebuild the chopper files because base url points to the literal value of the variable, with this change we don't need to rebuild in that scenerio because we can point the base url to a top level variable and that variable is going to be present in the generated file instead of the literal value
Imaging this case
Before the change:
After the change: