codeconsole opened a new pull request, #16771:
URL: https://github.com/apache/grails-core/pull/16771

   A parsed merge of an indexed key with a property after the index wrote the 
list under its flat key only; the nested map held an entry named after the 
element instead:
   
   ```groovy
   def config = new PropertySourcesConfig()
   config.merge(['app.rows[0].name': 'first', 'app.rows[0].port': '8080', 
'app.rows[1].name': 'second'])
   config.getProperty('app.rows', List)   // [[name:first, port:8080], 
[name:second]]
   config.navigate('app', 'rows')         // was null, now [[name:first, 
port:8080], [name:second]]
   config.app.rows                        // was not the list, now the list
   ```
   
   The nested map that owns the container now holds the list, or the map for a 
key such as `app.mappings[foo].name`, that the flat key holds. The flat keys 
are left as they were, so indexed keys such as `app.rows[0].name` are read as 
before and the environment presents the same names. `NavigableMapSpec` covers a 
dotted key, a key two levels down and a key inside a nested map; 
`PropertySourcesConfigSpec` checks the list through `navigate`, `getProperty` 
and dot notation after `config.merge`.
   
   Found while working on #16732; the bug is the same on every branch from 
7.0.x to 9.0.x. A configuration built from `application.yml` was not affected, 
since the config merges the list again under its flat key when it reads the 
file.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to