-
-
Notifications
You must be signed in to change notification settings - Fork 102
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
Generated client has conflicting request when OpenApi spec has "Request" tag #479
Comments
Hey @schehlmj, are you able to share your config? It looks like you're using a custom client instance? Can I ask why? |
I am generating with this: |
Why do you use |
I now see that it is deprecated in @next. I am using it as a carryover from before, but I am not tied to it. I am not sure what I should do instead. As a simple fix, I can just not use --name, and then just keep using the old generated AppClient.ts as my own src code. I don't see a way to just use the Services directly because I am not clear how I would authenticate. My current code has an app-client.ts:
Then I would just import appClient from that and use it like appClient.request.summary(requestId); |
If you're using it only for authorisation, you can set that function directly on OpenAPI config object https://github.com/ferdikoomen/openapi-typescript-codegen/wiki/Authorization We plan to improve this in the clients release too |
@mrlubos and @jordanshatford Thanks for you attention and help with this. One other nice thing about --name generated clients is that each instance of them can point to a different base URL. That isn't so easy to do with setting the OpenAPI singleton. Hopefully the clients release will handle that if --name generate clients are removed. |
Yep they will! |
Hey @schehlmj, the new Axios client is available now https://www.npmjs.com/package/@hey-api/client-axios Docs: https://heyapi.vercel.app/openapi-ts/clients.html#axios Let me know your thoughts if you do try it out |
@mrlubos It looks good. Thanks for your hard work on all this! |
Description
When the OpenApi Spec has "Request" tag, the generated client.ts contains both of these:
public readonly request: RequestService;
public readonly request: BaseHttpRequest;
These cause compile error in the client.ts.
My workaround is to rename this and all references to it:
public readonly httpRequest: BaseHttpRequest;
OpenAPI specification (optional)
Configuration
No response
System information (optional)
No response
The text was updated successfully, but these errors were encountered: