Skip to content

Refactor ParamsScope and Parameters DSL to use named kwargs#2663

Merged
dblock merged 1 commit into
masterfrom
refactor/named_kwargs_params_scope
Mar 9, 2026
Merged

Refactor ParamsScope and Parameters DSL to use named kwargs#2663
dblock merged 1 commit into
masterfrom
refactor/named_kwargs_params_scope

Conversation

@ericproulx

@ericproulx ericproulx commented Mar 7, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Replace positional/hash-based method signatures with named keyword arguments throughout ParamsScope and Parameters DSL
  • ParamsScope#initialize now uses api:, element: nil, element_renamed: nil, parent: nil, optional: false, type: nil, group: nil, dependent_on: nil
  • new_scope, new_lateral_scope, push_declared_params, validate_attributes all converted to named kwargs
  • new_scope first argument renamed from attrs to element — callers now pass attrs.first directly, removing the double attrs.first lookup inside the method
  • new_group_scope first argument renamed from attrs to group — callers now pass the group hash directly instead of wrapping it in an array
  • require_required_and_optional_fields and require_optional_fields now declare using:, except: nil explicitly instead of accepting an opaque opts hash — callers pass only the relevant keys
  • with converted from a positional hash to **opts keyword arguments — passing an explicit hash literal with({...}) will now raise ArgumentError (see UPGRADING.md)
  • Method comments updated to reflect new signatures throughout

Benefits

  • Method interfaces are self-documenting — required vs optional params are clear from the signature
  • Eliminates implicit hash contracts where callers had to know which keys were consumed
  • Prevents accidental passing of unrelated keys into methods

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Mar 7, 2026

Copy link
Copy Markdown

Danger Report

No issues found.

View run

ericproulx added a commit that referenced this pull request Mar 7, 2026
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@ericproulx ericproulx force-pushed the refactor/named_kwargs_params_scope branch 3 times, most recently from 4fd625f to 04bf07c Compare March 7, 2026 23:46
@ericproulx ericproulx requested a review from dblock March 7, 2026 23:46
Replace positional/hash-based method signatures with named keyword
arguments throughout: ParamsScope#initialize, new_scope, new_lateral_scope,
push_declared_params, validate_attributes, require_required_and_optional_fields,
and require_optional_fields. Callers updated accordingly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@ericproulx ericproulx force-pushed the refactor/named_kwargs_params_scope branch from 04bf07c to b676ed4 Compare March 7, 2026 23:48
@dblock dblock merged commit a0949ba into master Mar 9, 2026
80 checks passed
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