ruby / ruby/psych

deep merging

Open
#62 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
597
Forks
223
Avg merge
11h 23m
Merged PRs (30d)
3

Description

i noticed you cannot deep merge keys.

defaults: &defaults
  parent:
    nested_one: foo
    nested_two: bar

development:
  <<: *defaults
  parent:
    nested_one: bar

returns:

defaults:
  parent:
    nested_one: foo
    nested_two: bar
development:
  parent:
    nested_one: bar

but i was expecting:

defaults:
  parent:
    nested_one: foo
    nested_two: bar
development:
  parent:
    nested_one: bar
    nested_two: bar       # this key would exist in a proper deep merge

the yaml specs dont really cover how it is should work, but is there a deep merging solution? if it should deep merge, i can update the psych test specs.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Begin with the YAML merge-key behavior described in the issue and inspect the existing Psych test specs. Clarify whether nested mappings should merge, then add coverage for the shown defaults/development example; done means the expected nested_two value is preserved and the relevant tests pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.