-
Notifications
You must be signed in to change notification settings - Fork 206
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
aligns naming conventions across packages #676
Conversation
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.
The refactoring changes look good to me.
The github action for the httpClient project for dotnet needs to be updated to reflect the updated project name then we can merge this in.
http/java/okhttp/lib/src/main/java/com/microsoft/kiota/http/Library.java
Show resolved
Hide resolved
Thanks a lot! This is a very good catch of something I had looked over. Fixed. |
…stic from implementation
Signed-off-by: Vincent Biret <[email protected]>
be0fb9a
to
7dc7e14
Compare
Why are we keeping a marker interface for the request option? My suggestion is the keep There are multiple ways I can think of how the user can use the request option property, at least in JavaScript.
cc : @MIchaelMainer @zengin |
Isn't that already the case? My understanding is that the I believe the purpose of the PR is to rename |
|
@andrueastman I agree with you on this.
Here is my thought :
https://docs.microsoft.com/en-us/dotnet/standard/design-guidelines/interface?redirectedfrom=MSDN @baywet why are we renaming
Abort signal is just an example of a request configuration that is in Fetch Example:
https://developer.mozilla.org/en-US/docs/Web/API/AbortController This configuration can be per request basis
|
intellisense: you'd get a browsable reference and would be able to get right to the request option interface type declaration, which contains doc comments explaining you what is its purpose, if you'd like, we can beef up the doc comments but I feel like it solves you concern. the guidance you linked is from 2008... it feels like its scope was for dotnet and it's outdated. I believe the main reason they didn't recommend the marker interface pattern at the time is because type testing used to be much more costly back then. Now with the pattern matching and advanced type boxing, it's a different story. On top of that, in the case of TypeScript, the interface defines methods. abort controller: this should be implementation detail in the request adapter service, we can perfectly implement the cancel promise method to orchestrate the controller (I thought it already was doing that on most fetch implementations). Surfacing it to the fluent API surface level is breaking the abstractions contract (even if we hide that with an unknown type). timeout scenario; assuming canceling the promise aborts the request (either natively or through our own implementation), we can add a timeout middleware with the current infrastructure we have. That middleware can have default options, and also read in options passed in from the fluent API surface. It then only becomes a simple matter of combining our promise + a set timeout promise + promise.race. more reading renaming http core: http core didn't convey "what this does" when request adapter conveys the information "adapts request information into something else" (naming is hard). I hope this answers your concerns, don't hesitate if you have follow ups. |
I appreciate the move from IMiddlewareOption to RequestOption. It provides me more clarity of purpose (even though the options also can apply to how to handle things in a response) as I don't need to understand "middleware" as a concept. Is the scope of RequestInformation.options to only be used in middleware, or can we identify reasonable scenarios outside of middleware where it would be used? If it is only used in middleware, then <string, RequestOption> makes sense as we should have an expected interface for defining the information passed to middleware. If it would be used to alter behavior after the response information is passed beyond the middleware, then <string, any|object> makes sense to me. I appreciate the HttpCore to RequestAdapter change (#444) so that it better addresses the potential for different protocols to be used with OpenAPI. I'd like for us to consider taking this concept a step further and learn from python request.adapters so that we can register (mount in Python) different RequestAdapters to target unique APIs with their own middleware. This will better support multi-host API scenarios for a single client. |
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 think the new names describes the intent better. Also thanks for the disambiguation by avoiding the naming collision with HttpClient
.
I believe the purpose of the PR is to rename
IMiddlewareOption
toRequestOption
as in realityIMiddlewareOption
is an option for the request that just happens to be used in middleware. Renaming captures that this name is limiting as the option can be used for other scenarios as you described.
@andrueastman could you give an example to a use case of RequestOption
outside middlewares? My understanding was that we were removing the extra level of indirection based on the comment here, (#330 (comment)), but it would be great to hear if there are additional benefits to the renaming with an example. I think that can also help in answering @MIchaelMainer's question on what type the map should be.
Thanks for the additional context @zengin. I wasn't aware of the extra level of indirection present in the javascript sdk. I was also thinking in line with @MIchaelMainer thoughts where the With regards to the type, I don't think the current |
Signed-off-by: GitHub <[email protected]>
10e6437
Signed-off-by: GitHub <[email protected]>
Kudos, SonarCloud Quality Gate passed! |
Thanks everyone for all the great comments and discussions! merging. |
Description
Generation diff
microsoft/kiota-samples#317