openapi-generator icon indicating copy to clipboard operation
openapi-generator copied to clipboard

#17876: Rust Server: Update dependency versions -- hyper 1.6, tokio 1.45, etc.

Open azriel-healthpoint opened this issue 7 months ago • 5 comments

  • Related to #17876, this is the rust-server half.

Short version:

  1. This likely should've been done against the 8.0.x branch, but I began the branch off master, and I pulled as much time as I can to push it back upstream (sorry 🙇).
  2. This means if any changes need to be made, someone else has to pick it up from here -- I'm essentially leaving you with where I got to.
  3. I haven't actually tested this via generation -- just ported the code over after getting things to compile on a project.
  4. Biggest changes are hyper 0.14 to 1.6, and tokio 0.2 to 1.45.
  5. hyper's service_fn requires hyper::service::service::Service to return a Request<Incoming>. The previous version had a Service return another Service
  6. Swagger 7.0.0-rc1 is needed because that depends on hyper 1.x; https://github.com/Metaswitch/swagger-rs/pull/179 may be of interest.

PR checklist

  • [x] Read the contribution guidelines.
  • [x] 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)
  • [x] If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

cc: @frol @farcaller @richardwhiuk @paladinzh @jacob-pro

azriel-healthpoint avatar May 27 '25 06:05 azriel-healthpoint

thanks for the PR

https://github.com/OpenAPITools/openapi-generator/actions/runs/15284539236/job/43442947536?pr=21332

please update the samples when you've time

wing328 avatar Jun 04 '25 07:06 wing328

This likely should've been done against the 8.0.x branch, but I began the branch off master, and I pulled as much time as I can to push it back upstream (sorry 🙇).

agreed. another way is to merge this into master and provide rust-server-deprecated for fallback instead so that users can fallback to current setup if they want to

wing328 avatar Jun 04 '25 07:06 wing328

I haven't actually tested this via generation -- just ported the code over after getting things to compile on a project.

would be nice if you can run some tests and ideally run it in production to ensure the output is ready for production

wing328 avatar Jun 04 '25 07:06 wing328

Heya, I regenerated samples, and discovered the templates aren't updated in use-cases that weren't in my project.

I've progressed it a little more, but the generated sample code doesn't compile yet.

Probably best if someone else picks up from here, my workflow is:

# in one terminal
./bin/generate-samples.sh ./bin/configs/rust-server-*.yaml || exit

# in another terminal
cd samples/server/petstore/rust-server/output/openapi-v3
cargo run --example server
# then use compile errors as hints where to change

azriel-healthpoint avatar Jun 11 '25 20:06 azriel-healthpoint

hyper 1.6, tokio 1.45

what about updating just one of the dependencies (either hyper or tokio) to make all the tests pass first in this PR to start with?

wing328 avatar Jun 16 '25 02:06 wing328

I've picked this up from where you got to @azriel-healthpoint and have done the following.

  • All rust-server samples compiling
  • Added a rust-server-deprecated as a fallback for hyper0.14 users
  • Additional testing in CI that the samples compile and pass checks
  • Re-add the typed headers auth changes added by @cvkem

I think it makes sense to move the changes to a new PR, #21422. @wing328 does that sound acceptable?

dsteeley avatar Jun 17 '25 07:06 dsteeley

https://github.com/OpenAPITools/openapi-generator/actions/runs/15595463910/job/44141290175?pr=21332

can you please review the build failure when you've time?

wing328 avatar Jul 02 '25 08:07 wing328

https://github.com/OpenAPITools/openapi-generator/actions/runs/15595463910/job/44141290175?pr=21332

can you please review the build failure when you've time?

See https://github.com/OpenAPITools/openapi-generator/pull/21422 which I've now fixed up and should supersede this PR.

Any objections to closing this one for clarity on where the changes are being made?

dsteeley avatar Jul 02 '25 17:07 dsteeley

agreed. just closed it

wing328 avatar Jul 02 '25 17:07 wing328