Closed aadu closed 6 years ago
Hi. Thanks for your pull request. Can you please add some more details about the new options to the README, similarly to how other options are documented? At the moment, I don't exactly understand how this works.
For example, I don't understand what is supposed to happen with nested changes. For example, this code gives me a RefResolutionError: Unresolvable JSON pointer: u'a/a'
:
schema = {
'mergeStrategy': 'objectMerge',
'mergeOptions': {'renameConflicts': True}}
base = None
base = jsonmerge.merge(base, {'a': {'a':1}}, schema)
base = jsonmerge.merge(base, {'a': {'b':2}}, schema)
What happens on subsequent merges? It seems that the renamed property simply gets overwritten.
Passing
"renameConflicts": true
inmergeOptions
will cause conflicting properties to be renamed instead of overwritten when using theObjectMerge
strategy. By default, the new property name of the conflicting file will be the previous property name with'-conflict'
appended to it. The suffix and/or prefix used for renaming the conflicting property can be set using therenameSuffix
andrenamePrefix
properties inmergeOptions
. Anyways, neat library (discovered it a little earlier today). The only thing I was missing was the ability to rename conflicting fields.