Fix #25722: forward kwargs through Configuration#use in ruby-nextgen

IN
19h ago
+11-10

Fixes #25722

Configuration#use(middleware, *args, &block) collapsed keyword arguments into a positional Hash, and configure_faraday replayed them positionally — a middleware with initialize(app, app_key:) (like the README's own OvhSignature example) raised ArgumentError: wrong number of arguments.

use now stores [middleware, args, kwargs, block] and the replay forwards *args, **kwargs, █ empty-kwargs forwarding is a no-op on Ruby >= 3.0, and legacy positional-hash callers keep working unchanged. Generated configuration.rb for petstore and ruby-nextgen-qdrant regenerated; the middleware-seam generator test extended to assert the kwargs forwarding.

Verified end-to-end on Ruby 4.0.10 + faraday 2.15.1 (the issue's versions): the middleware receives app_key: as a true kwarg through a real request, legacy positional-hash middlewares unaffected. RubyNextgenClientCodegenTest 24/24; sample rspec 23/23.


Summary by cubic

Fixes #25722 by making Configuration#use forward keyword arguments as real kwargs to Faraday middlewares instead of collapsing them into a positional Hash, which broke middlewares with keyword-only initializers like the README's OvhSignature.

  • use(middleware, *args, &block) is now use(middleware, *args, **kwargs, &block); the stored tuple includes kwargs, and the replay forwards **mw_kwargs.
  • Empty-kwargs forwarding is a no-op on Ruby >= 3.0, so legacy positional-hash callers keep working unchanged.
  • Regenerated petstore and ruby-nextgen-qdrant configuration.rb samples and extended the middleware-seam generator test to assert kwargs forwarding.
  • Verified end-to-end on Ruby 4.0.10 + faraday 2.15.1, the versions from the issue.