π§ Support multiple --mappings-file flags with deep merge capability #67
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.
π§© Feature Implementation
This PR implements support for multiple
--mappings-fileflags as requested in issue #66.β What Changed
Core Functionality
--mappings-fileflags usingaction='append'_deep_merge_dicts()method for intelligent mergingUsage Examples
Basic multiple mappings:
struct generate \ --mappings-file ./common-mappings.yaml \ --mappings-file ./env-specific-mappings.yaml \ file://my-struct.yaml .Environment-based automation:
struct generate \ --mappings-file ./mappings/common.yaml \ --mappings-file ./mappings/${ENVIRONMENT}.yaml \ file://infrastructure.yaml \ ./outputMerging Behavior
Input files:
common.yaml:production.yaml:Merged result:
π οΈ Technical Implementation
Deep Merge Algorithm
Error Handling
Backward Compatibility
--mappings-fileusage remains unchangedπ Documentation Updates
π§ͺ Testing
Added comprehensive tests covering:
π Benefits
For CI/CD Automation
For DRY Principles
For Complex Projects
π Resolves
Closes #66
This implementation provides the exact functionality requested in the issue while maintaining backward compatibility and adding comprehensive documentation and testing.