Skip to content

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

Open
Inf1mum wants to merge 1 commit into
OpenAPITools:masterfrom
Inf1mum:fix/25722-config-use-kwargs
Open

Inf1mum wants to merge 1 commit into
OpenAPITools:masterfrom
Inf1mum:fix/25722-config-use-kwargs

Conversation

@Inf1mum

@Inf1mum Inf1mum commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

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.

Written for commit 31c9633. Summary will update on new commits.

View guided diff

…the Faraday middleware

Signed-off-by: Inf1mum <vadimlazuk5@gmail.com>

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 4 files

View guided diff | Re-trigger cubic

This branch has not been deployed

No deployments
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.

[BUG][RUBY-NEXTGEN] config.use drops keyword arguments, so the README middleware example raises ArgumentError

1 participant