Skip to content

Conversation

@misdoro
Copy link

@misdoro misdoro commented Aug 5, 2025

Currently there is no way to delete a hash key when merging two hashes.
Additionally, when using knock-out, when the child value is a hash, it will be replaced by an empty string, changing the data type of a value.

Update the code to knock-out hash keys instead of replacing them with an empty string.
I understand this is a breaking change as-is, happy to introduce an extra configuration flag for the new behavior.

Somewhat similar to #36 , happy that I was not the only one finding the current behavior inconsistent.

Usecase: for https://github.com/rubyconfig/config it is currently impossible to remove an optional hash from the common configuration.

This leads to impossibility of validating a schema like

optional(:server).schema do
    required(:hostname).value(:string)
    required(:port).value(:string)
end

where settings.yml looks like

server:
  host: localhost
  port: 1234

and overriding yml looks like

server: --

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.

1 participant