-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
[Rust][Bounty] Issues with client code generation. #6178
Comments
👍 Thanks for opening this issue! The team will review the labels and make any necessary changes. |
You can use
In CLI, you need to add |
Some other generators (e.g. PHP, Java (jersey2)) already support Basically we need to do the same for Rust client generator. |
@wing328 any luck that this is picked up soon? |
Done via #6230 |
It seems that params structures as well as their fields generated by #6230 are private and hence are not usable :( |
Please use the option
|
Still no dice. The |
@imp do you mind showing the error message you got when using the |
@wing328 Here we go:
So the |
@imp thanks for the info. I'll take another look tomorrow. |
Confirm it works now. Although now all the [
instead of current
That way the consumer has the choice of importing these structures from apis.rs with longer names as well as pulling them from the inner module with shorter names if there in fact would be no name conflicts. Just a thought. |
Sounds good. I'll file a PR |
@wing328 First of all: Thanks for great work! But when activating the option on the current snapshot (), the code won't compile. I am afraid #6470 broke the re-exports in diff --git a/templates/reqwest/api_mod.mustache b/templates/reqwest/api_mod.mustache
index 5e98f19..46f6471 100644
--- a/templates/reqwest/api_mod.mustache
+++ b/templates/reqwest/api_mod.mustache
@@ -67,7 +67,7 @@ pub use self::{{{classFilename}}}::{ {{{operationId}}} };
{{#vendorExtensions.x-group-parameters}}
{{#allParams}}
{{#-first}}
-pub use self::{{{classFilename}}}::{{{operationIdCamelCase}}} as {{{classname}}}{{{operationIdCamelCase}}};
+pub use self::{{{classFilename}}}::{{{operationIdCamelCase}}}Params as {{{classname}}}{{{operationIdCamelCase}}}Params;
{{/-first}}
{{/allParams}}
{{/vendorExtensions.x-group-parameters}} Or am I wrong here? |
@HenningHolmDE thanks for reporting the issue and suggesting the fix. Sorry for the regression. I've filed #6586 to fix it and add a test to catch the issue moving forward. |
@HenningHolmDE the fix has been merged into master. Please pull the latest to give it another try. |
a la pub enum Error<T> {
Reqwest(reqwest::Error),
Serde(serde_json::Error),
Io(std::io::Error),
ResponseError(T),
} |
I believe all tasks have been completed. Thanks @seunlanlege again for sponsoring these fixes/enhancements 🙏 |
Description
The generated client code for rust has a few problems:
The models are properly generated but the return type of the methods don't reference the generated models at all.
openapi-generator version
OpenAPI declaration file content or url
https://api.slack.com/specs/openapi/v2/slack_web.json
Command line used for generation
java -jar ~/Downloads/openapi.jar generate -g rust -i https://api.slack.com/specs/openapi/v2/slack_web.json -o rust
Steps to reproduce
run the command above
Related issues/PRs
Suggest a fix/enhancement
reqwest
crate with async/await.to:
Instead of:
do:
I'm willing to sponsor work on this issue to the tune of $500.
cc @wing328
The text was updated successfully, but these errors were encountered: