-
Notifications
You must be signed in to change notification settings - Fork 31
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 official way to opt out of using Get #84
Comments
To support all three scenarios, I was thinking that maybe we could do it via either an enum or two bools: Default Behaviour (using Get)paths:
requestType: useGet paths:
isUsingGet: true
isGeneratingRequestType: false Use Different
|
From my comment in #85, we can create a For
|
There is still the scenario to cover where we want to generate the This is particularly useful when using |
I would assume in that scenario that the Or, we can expand the options to
Edit: actually, since I just glanced at Or now that it's a binary option, we have the flag |
Please see the bottom of the following comment first: #136 (comment) The question regarding this specifically is: should we tightly couple CreateAPI to a specific networking package? The meaning of tightly couple is the same as in the comment. For this specifically, my opinion is strongly no. As a generator, we don't care about the underlying networking implementation by the developer. By generalizing the Request object, we just do that: create a request and the developer passes it onto the implemented networking stack, post-processing if desired to match their stack. As said in the attached comment, we can happily recommend Get and provide the boilerplate config options in documentation, probably when talking about how to use CreateAPI and describing the Request type. So, the |
An enum sounds good. Maybe something like this: apiClientType: Enum The networking library to use:
CreateAPI and Get are part of the same "ecosystem". It can be considered the same as using If typealias APIClient = Get.APIClient For more advanced use-cases (e.g. no |
Background
As it stands, to opt out of using Get, you must do three things:
--module
modepaths.imports
to be an empty arrayRequest
shimWhile we believe that using CreateAPI with Get it the quickest and easiest option, we understand that not everybody is in a position to adopt Get. As a result, we need to provide a better way to disable use of the dependency.
Description
I can think of three scenarios:
Request
in a module that should be importedRequest
type generated for youI did at first think that we should just generate
Request
if you opted not to use Get, but this will put some people who already import a different module definingRequest
in a situation where they can't use the generated code. It might be that like Get, theRequest
type is used for manually crafted requests too so defining it inside the CreateAPI generated package might not be appropriate.Not sure how best to handle this...
The text was updated successfully, but these errors were encountered: