Skip to content

[yamlcomposer] Add !deep <<: tag to extend merge keys with recursive deep merge and conflict resolution - #21505

Draft
jimtng wants to merge 1 commit into
openhab:mainfrom
jimtng:yamlcomposer-deepmerge
Draft

[yamlcomposer] Add !deep <<: tag to extend merge keys with recursive deep merge and conflict resolution#21505
jimtng wants to merge 1 commit into
openhab:mainfrom
jimtng:yamlcomposer-deepmerge

Conversation

@jimtng

@jimtng jimtng commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Implement recursive mapping composition and explicit node precedence controls across the YAML composition engine.

This significantly enhances package and include definitions by allowing modular files to:

  • Define default values that can be easily overridden by downstream configs.
  • Define additional nested structures and elements to be combined recursively.

Key changes:

  • Add !deep <<: directive to support recursive merging of nested mapping trees and sequence item appending with deduplication.
  • Add conflict resolution tags (!default, !freeze/!replace, !remove) to override standard local-target precedence, lock nodes, or suppress keys during composition.
  • Introduce StructuralMerger to unify structural composition across YAML merge keys, deep merge directives, and package resolution.
  • Refactor PackageProcessor to process package content through the shared structural merge pipeline.
  • Register !deep and !default placeholders, directives, and processors in ModelConstructor and YamlComposer.
  • Add documentation reference guides (doc/deep-merge.md) and unit test suite (YamlComposerDeepMergeTest).

@jimtng jimtng changed the title [yamlcomposer] Add !deep <<: tag to extend merge keys with recursive deep merge and conflict resolution [yamlcomposer] Add !deep <<: tag to extend merge keys with recursive deep merge and conflict resolution Aug 27, 2026
@jimtng
jimtng force-pushed the yamlcomposer-deepmerge branch from 35e48cc to 5a911de Compare August 27, 2026 10:46
@openhab-bot

Copy link
Copy Markdown
Collaborator

This pull request has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/yaml-composer-tips/170229/2

@jimtng
jimtng force-pushed the yamlcomposer-deepmerge branch from 5a911de to 75620f7 Compare August 27, 2026 11:11
@jimtng
jimtng marked this pull request as ready for review August 27, 2026 12:05
@jimtng
jimtng force-pushed the yamlcomposer-deepmerge branch from 75620f7 to c8deb98 Compare August 28, 2026 10:22
@jimtng
jimtng marked this pull request as draft August 28, 2026 11:16
@lsiepel lsiepel added the enhancement An enhancement or new feature for an existing add-on label Aug 28, 2026
@jimtng
jimtng force-pushed the yamlcomposer-deepmerge branch from c8deb98 to 3ac75c4 Compare August 28, 2026 14:38
…deep merge and conflict resolution

Implement recursive mapping composition and explicit node precedence controls across the YAML composition engine.

This significantly enhances package and include definitions by allowing modular files to:
- Define default values that can be easily overridden by downstream configs.
- Define additional nested structures and elements to be combined recursively.

Key changes:
- Add `!deep <<:` directive to support recursive merging of nested mapping trees and sequence item appending with deduplication.
- Add conflict resolution tags (`!default`, `!freeze`/`!replace`, `!remove`) to override standard local-target precedence, lock nodes, or suppress keys during composition.
- Introduce `StructuralMerger` to unify structural composition across YAML merge keys, deep merge directives, and package resolution.
- Refactor `PackageProcessor` to process package content through the shared structural merge pipeline.
- Register `!deep` and `!default` placeholders, directives, and processors in `ModelConstructor` and `YamlComposer`.
- Add documentation reference guides (`doc/deep-merge.md`) and unit test suite (`YamlComposerDeepMergeTest`).

Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
@jimtng
jimtng force-pushed the yamlcomposer-deepmerge branch from 3ac75c4 to 7ca4b23 Compare August 28, 2026 22:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement An enhancement or new feature for an existing add-on

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants