Skip to content

Add opt-in YAML merge key resolution #66

Description

Context

YAML 1.2.2 core schema treats << as an ordinary mapping key, but many YAML documents use the YAML 1.1 merge-key convention. The module should support merge-key expansion as an explicit compatibility capability, never as default YAML 1.2 behavior.

Official references:

Current State

The module correctly treats << as ordinary mapping data by default. There is no opt-in parameter to expand merge keys when consuming YAML from tools that still emit the YAML 1.1 merge-key convention.

Objective

Add explicit merge-key expansion that composes with parsing, validation, formatting, merging, and PowerShell projection without changing the YAML 1.2 default.

PowerShell Design Considerations

  • Use an explicit switch such as -ResolveMergeKey; do not overload default parsing.
  • Keep parameter symmetry across string conversion, file import, validation, formatting, and merging.
  • Make merge expansion happen before projection so rich PowerShell objects receive the expanded mapping.
  • Keep error behavior classified for invalid merge values, duplicate merge keys, and merge cycles.

Tasks

  • Add opt-in merge-key expansion for mappings and aliases to mappings.
  • Support sequence-of-mappings merge values with YAML merge precedence rules.
  • Preserve direct-entry precedence over contributed merge entries.
  • Detect invalid merge values, duplicate merge keys, and merge cycles.
  • Apply resource limits to expansion work.
  • Document default YAML 1.2 behavior and opt-in YAML 1.1 compatibility behavior.

Benefits

  • Improves interoperability with common YAML files that still use merge keys.
  • Keeps YAML 1.2 conformance by default.
  • Gives script authors a clear and discoverable compatibility switch.

Acceptance Criteria

  • << remains ordinary mapping data without the opt-in switch.
  • Merge keys expand correctly with the opt-in switch.
  • Direct entries override merged entries without duplicate-key errors.
  • Invalid merge values and cycles terminate with classified errors.
  • Test-Yaml, Format-Yaml, and Merge-Yaml honor the opt-in behavior consistently.

Related

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions