Skip to content

Conversation

@Syati
Copy link
Owner

@Syati Syati commented Sep 8, 2025

This pull request enhances the StructuredParams::Params class by introducing a new compact option to the attributes and serialize_structured_value methods, allowing for recursive removal of nil values from structured parameter hashes. The changes also update type signatures and add comprehensive tests to ensure correct behavior.

Feature addition: Compact attributes

  • Added a compact keyword argument to the attributes and serialize_structured_value methods in lib/structured_params/params.rb, enabling recursive removal of nil values from returned hashes. [1] [2]

Type signature updates

  • Updated the attributes and serialize_structured_value method signatures in sig/structured_params/params.rbs to reflect the new compact argument and its accepted combinations. [1] [2]

Test coverage

  • Modified and extended tests in spec/params_spec.rb to cover the new compact option, including cases with nested hashes, arrays, and symbolized keys, verifying that nil values are removed as expected. [1] [2]

Copilot AI review requested due to automatic review settings September 8, 2025 11:45
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a compact option to the attributes and serialize_structured_value methods in the StructuredParams::Params class, enabling recursive removal of nil values from structured parameter hashes.

  • Added compact keyword argument to core serialization methods
  • Updated RBS type signatures to reflect the new parameter combinations
  • Enhanced test coverage for the compact functionality with various data structures

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
lib/structured_params/params.rb Added compact parameter to attributes and serialize_structured_value methods with nil removal logic
sig/structured_params/params.rbs Updated type signatures to include compact parameter combinations
spec/params_spec.rb Added comprehensive test cases for compact functionality with nested structures and symbolized keys

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@Syati Syati merged commit 1798205 into main Sep 8, 2025
6 checks passed
@Syati Syati deleted the attributes_compact branch September 8, 2025 11:51
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