Not having any specific opinion here but just for an example. Maven
allows merging of config [1] but that requires parent config to
declare/allow the child to merge there config. So merging "intention"
is explicitly mentioned.

So if we plan to support this sometime later (with a big if!) then
probably we can have such meta config settings to express this merge
intention.

Chetan Mehrotra
[1] 
http://blog.sonatype.com/2011/01/maven-how-to-merging-plugin-configuration-in-complex-projects/


On Fri, Jul 29, 2016 at 8:09 PM, Carsten Ziegeler <[email protected]> wrote:
>> Hi,
>> Properties should not be merged, as that will produce undesirable side
>> effects, however some things need to be merged.
>>
>> Having attempted to write documentation I found it easiest to describe in
>> terms of json documents.
>> Using the examples in
>> https://gist.github.com/ieb/460504e79c861cb980f4f0154210a869
>>
>> given 2 configs from different locations
>>
>> Location A
>>
>>     {
>>         "socialmedia" : {
>>             "youtube" : {
>>                 "enabled" : false,
>>                 "url" : "https://youtube.com";
>>             },
>>             "facebook" : {
>>                 "enabled" : false,
>>                 "apiusage" : false,
>>                 "url" : "https://youtube.com";
>>             },
>>
>> Location B
>>
>>  {
>>         "socialmedia" : {
>>             "facebook" : {
>>                 "enabled" : true,
>>                 "url" : "https://facebook.com";
>>             }
>>         }
>>     }
>>
>>
>> The result of A then B should be
>>
>> {
>>         "socialmedia" : {
>>             "youtube" : {
>>                 "enabled" : false,
>>                 "url" : "https://youtube.com";
>>             },
>>             "facebook" : {
>>                 "enabled" : true,
>>                 "url" : "https://facebook.com";
>>             }
>>         }
>>     }
>>
>>
>> ie Objects are merged but properties are not. socialmedia.facebook from A
>> does not add @apiusage to the result, as socialmedia.facebook form B
>> overwrites socialmedia.facebook from A.
>>
>> That will allow a deployer to completely replace a configuration "object"
>> without having to get their head around more complex inheritance rules.
>> This does assume that configurations are collected together into "objects".
>> I think its is important to keep it simple.
>> If this isnt simple enough then it needs some more thought.
>>
>
> Yes, I think we agree on this, and that's how my implementation
> currently works). So for your above example if we have "A then B" and
> you get the collection for "socialmedia" you get "youtube" and
> "facebook" with the properties you list above.
>
> This is merging on a resource collection level and yes, we must do that.
> My post here was more about merging properties, sorry that I didn't make
> this clear :)
>
> But it's great that we have a common understand now
>
> Thanks
> Carsten
>
> --
> Carsten Ziegeler
> Adobe Research Switzerland
> [email protected]
>

Reply via email to