Refactor: ClientConfigBuilder-specific BuilderConfig object for configuration handling#1480
Refactor: ClientConfigBuilder-specific BuilderConfig object for configuration handling#1480pileks merged 69 commits intoorigin-devfrom
BuilderConfig object for configuration handling#1480Conversation
…-config-refactor Refactor `ClientConfigBuilder.build`
…toolchain into pileks/refactor-client-updates
nerfZael
left a comment
There was a problem hiding this comment.
Most of this looks great.
I left two comments.
Additionally, I find the Generic** types really awkward
We will delete those in a future PR: |
There was a problem hiding this comment.
looking solid 👏 - i share the sentiment of Jure of having the two types but I think it's fine to fix this in another PR so we don't get things bigger.
The only idea I would give is that, since we want to fix the TUri generic not going in through the entire client, we maybe have this generic only in the builder, and this takes care of sanitizing the URIs, the client would only expect an URI and wont know about any generics. Making the core types just expect Uri instead of TUri
Just one minor thing to change (an unused dependency) and we're good to go
13bd143 to
f876383
Compare
It will still be beneficial to trace subinvocation traces, tryResolverUri, loadWrapper, or any other top-level functions. |
tbh i feel we're not really using the tracing - i think discussing to improve/remove it is worth it |
|
|
||
| // $start: Uri-toString | ||
| /** @returns Uri string representation */ | ||
| public toString(): string /* $ */ { |
There was a problem hiding this comment.
I'll assume that this would render the URI as a string within interpolated strings, but that's as far as I can fathom this.
TBH I've only now seen this and it's something that's been in the Uri class before, it's just been moved from lines 104-115 to here.
There was a problem hiding this comment.
Yeah I noticed that but not sure we need this functions in the first place
Niraj-Kamdar
left a comment
There was a problem hiding this comment.
LGTM! Let's get this merged and then cleanup legacy
I've completed the requested changes, github is just being weird :)
This is a continuation of #1465. Huge props to @Niraj-Kamdar for doing the bulk of the work around this.
This PR introduces the concept of
BuilderConfig, which is aClientConfigBuilder-specific configuration object wherein the individual configuration sections take the shape of aRecord<string, SectionType>.This allows us to configure the client in a very readable fashion.
Let's take
config.envsas an example.Before, we used to write:
Now we can write a much more succint form of the configuration:
This can also be seen as precursor work to #1283 as it lays the foundation of the "ideal" layout of our final config objects.
Thank you @krisbitney for the note that this PR does a few more things than the description initially explained, these are: