Open xoxys opened 4 years ago
Thanks your report!
If there is a type conflict like in this case (value: dict should be merged with value: list) I would expect a fallback to simply override it.
As you know, there is no good default to merge a string with a list. Also type conflicts may indicate that given data are somehow invalid. So I don't want anyconfig behaving smart as you suggested and just let users decide what should be done for such cases.
In your case, I think it would be better if the later one is like ... ''minio_prefix': {'value': '']} ... or ... ''minio_prefix': {'value': 'unset'}.... (The identity element of monoid string is '' (empty string), I guess.)
Thanks for your feedback. In this case it is not possible to refactor the later one because it is parsed from user input. But you are right, if the in put is malformed I should through an exception instead of some magic :)
Although I still believe anyconfig should not behave too 'smart' and hide any some unexpected cases it should not process originally, I changed my mind and think that it might be useful if the following merge strategies are available in anyconfig:
How do you think about this? If you like this idea and want, I'll try to implement those merge strategies.
@ssato sorry for the late respons. I guess, having a merge strategy to handle such cases would be cool. How does these two described strategies handles current options for list append and dict merge?
Hi,
I try to merge some nested dicts like this:
... 'minio_prefix': {'value': {'minio_prefix': 'aaa'}} ...
with... ''minio_prefix': {'value': ['_unset_']} ...
but get an exception:Any suggestions how to work around it? If there is a type conflict like in this case (value: dict should be merged with value: list) I would expect a fallback to simply override it.