feat: add --merge-file / -M CLI option for deep merging#42
Merged
candleindark merged 3 commits intodandi:mainfrom Mar 24, 2026
Merged
feat: add --merge-file / -M CLI option for deep merging#42candleindark merged 3 commits intodandi:mainfrom
candleindark merged 3 commits intodandi:mainfrom
Conversation
Generalize the exception name so it can be used for both the overlay and the upcoming deep-merge feature. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds a new -M / --merge-file option that deep-merges a YAML file into the generated schema using deepmerge. Values from the merge file win on conflict. Unlike -O, no field filtering is applied. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- ruff format applied to cli/__init__.py, tools.py, test_cli.py, test_tools.py - CLAUDE.md: document new CLI options (-M, -O) and the updated tools/exceptions architecture - README.md: add options table documenting -M, -O, -o, -l Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #41.
Summary
OverlayContentError→YAMLContentErrorso the exceptioncan serve both the overlay and the new deep-merge feature.
-M/--merge-fileCLI option that deep-merges a user-supplied YAML file into the generated schema using
deepmerge. Values from themerge file win on conflict; no
SchemaDefinitionfield filtering isapplied (unlike
-O).-Moption is applied before-Oin the post-processingpipeline.
deepmergeas a runtime dependency.CLAUDE.mdandREADME.mdto document the new option andupdated architecture.
Changes by commit
refactor: rename OverlayContentError to YAMLContentError—generalises the exception; updates all references and tests.
feat: add --merge-file / -M CLI option for deep merging— addsapply_yaml_deep_merge()intools.py, the-MCLI option, andTestCliDeepMerge+TestApplyYamlDeepMergetest classes.chore: apply ruff formatting and update documentation— ruffformat pass; updates
CLAUDE.mdandREADME.md.Test plan
hatch run test.py3.10:pytest tests/test_cli.py tests/test_tools.py::TestApplyYamlDeepMerge— all new tests passhatch run test.py3.10:pytest tests/— full suite passes (3337 passed, 14 xfailed)ruff check .— no lint errorsruff format --check .— no formatting issueshatch run types:check— no new type errors introduced-Mwith a nested merge againstdandischema.models— a class-leveldescriptionoverride was correctly merged while the rest of the schema was preserved🤖 Generated with Claude Code