Skip to content

Conversation

ThomasVille
Copy link
Contributor

In a previous PR ([Rust ]Add async file stream support for reqwest client): the useAsyncFileStream and vendorExtensions.useAsyncFileStream template variables are used in case there's at least one file uploaded in the body, but they are set as long as supportAsync is set and any parameter is a file (including if the file is in a form). So these variables are set more often than they should, introducing unused dependencies on tokio.

This explains why on master, these tests have the tokio dependency even though they don't use it:

This PR sets the useAsyncFileStream and vendorExtensions.useAsyncFileStream template variables only when at least one body parameter is a file.

This PR doesn't break the feature introduced by [Rust ]Add async file stream support for reqwest client, as can be seen in the samples/client/others/rust/reqwest/file-streaming example.

PR checklist

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • Run the following to build the project and update samples:
    ./mvnw clean package || exit
    ./bin/generate-samples.sh ./bin/configs/*.yaml || exit
    ./bin/utils/export_docs_generators.sh || exit
    
    (For Windows users, please run the script in WSL)
    Commit all changed files.
    This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
    These must match the expectations made by your contribution.
    You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*.
    IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
  • File the PR against the correct branch: master (upcoming 7.x.0 minor release - breaking changes with fallbacks), 8.0.x (breaking changes without fallbacks)
  • If your PR solves a reported issue, reference it using GitHub's linking syntax (e.g., having "fixes #123" present in the PR description)
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

@frol (2017/07) @farcaller (2017/08) @richardwhiuk (2019/07) @paladinzh (2020/05) @jacob-pro (2022/10) @dsteeley (2025/07)

@wing328
Copy link
Member

wing328 commented Aug 29, 2025

thanks for the PR

is it possible to add a new workflow (or updating the exiting one) to catch the issue moving forward?

@ThomasVille
Copy link
Contributor Author

@wing328 Which workflow are you referring to?

I'm not sure how we could catch this issue. Maybe we could call RUSTFLAGS: "-D warnings" cargo build to make sure the generated code builds and doesn't produce any warning like unused code?

@ThomasVille
Copy link
Contributor Author

Ah I just saw that some tests are disabled in this workflow:

# Skip samples/client/petstore/rust/ as its tests are failing.
.

@ThomasVille
Copy link
Contributor Author

@wing328 Since there's no such test (making sure the build doesn't produce any warning) today, if I add it in this PR, I risk having to fix all sorts of errors introduced before and that are not related to this PR.

So maybe we can open another issue to add this workflow?

@wing328
Copy link
Member

wing328 commented Aug 29, 2025

agreed.

i'll take a look over the weekend to see why the rust client tests are skipped.

have you tested this fix locally in your environment to confirm it fixes the mentioned issue?

if yes, i'll get it merged so that more users can test the change after merge

@ThomasVille
Copy link
Contributor Author

@wing328 Yes I tested it locally on my own project and it works on the petstore samples too.

@wing328 wing328 merged commit 9c1b680 into OpenAPITools:master Aug 29, 2025
20 checks passed
@wing328
Copy link
Member

wing328 commented Sep 1, 2025

fyi. rust client ci fixed via #21851

Goopher pushed a commit to Goopher/openapi-generator that referenced this pull request Sep 9, 2025
@wing328 wing328 added this to the 7.16.0 milestone Sep 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants