Okay so... Take document 1 + document 2 Do a recursive merge - Named properties overwrite scalars - This is based on the _target_ type, if the source has a map and the target has a scalar... it overwrites the entire map with the scalar, if the target is a map and the source is a scalar, the scalar is tossed away and overwritten Later, implement ways to control this merge. E.g., "!Replace" to replace an entire block. Things we might need: !Replace -- replace entire block !Unset -- remove value, any children, etc So: ``` AwsWhatever: '2020-01-01' Resources: SecurityGroup: VpcId: 1234 Name: Test UseSuperSecurity: True Subnets: - us-east-1a - us-east-1b Users: Alice: 'aws:arn:1234:alice' Bob: 'aws:arn:1234:bob' ``` + ``` Resources: SecurityGroup: Name: NewGroup UseSuperSecurity: !Unset ~ NewValue: True Subnets: - us-east-1c Users: !Replace Charlie: 'aws:arn:1234:charlie' ``` = ``` AwsWhatever: '2020-01-01' Resources: SecurityGroup: # Values not specified are unchanged VpcId: 1234 # Scalar values specified are replaced Name: NewGroup # !Unset removes a value/block/etc # UserSuperSecurity: # Values that don't exist in the original doc are added NewValue: True # Arrays are appended Subnets: - us-east-1a - us-east-1b - us-east-1c # Replace stops the merge and just does a copy from the new document Users: Charlie: 'aws:arn:1234:charlie' ```