Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@akang31
Copy link
Contributor

@akang31 akang31 commented Nov 13, 2024

Add support for understanding the Spring YML (YamlPropertiesFactoryBean) way of parsing YML files via the Archaius endpoints. This supports the ConfigProxy and PropertyRepository as these all are eventually backed by AbstractConfig.

This enables all existing Archaius read methods to read multi-line/multi-property maps and arrays as specified by Spring.

Spring YML files are converted to configs from this yml file

test:
    map:
        key1: 1
        key2: 2
        key3: 3
    stringList:
        - a
        - b
        - c

To these configs:

test.map.key1=1
test.map.key2=2
test.map.key3=3
test.stringList[0]=a
test.stringList[1]=b
test.stringList[2]=c

return rawType;
}

public boolean isMap() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe move these two to be private static helper methods in AbstractConfig? Then things would work with any ParametrizedType, not just with ArchaiusType.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call, moved these into the AbstractConfig instead

Copy link
Contributor

@rgallardo-netflix rgallardo-netflix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is almost there!
Could you add tests for ... ?

  • Reading these through a config proxy
  • Reading a non-string yml value (ie, something like key: 1 with an unquoted int)
  • No regressions when reading the raw mapNamePrefix.mapKey as a "normal" key

@akang31
Copy link
Contributor Author

akang31 commented Jan 15, 2025

I think this is almost there! Could you add tests for ... ?

  • Reading these through a config proxy
  • Reading a non-string yml value (ie, something like key: 1 with an unquoted int)
  • No regressions when reading the raw mapNamePrefix.mapKey as a "normal" key

Added some more tests to address these cases

@akang31 akang31 merged commit 7ed4e17 into 2.x Jan 15, 2025
10 checks passed
@akang31 akang31 deleted the 2.x-reading-collections-from-yml branch January 15, 2025 21:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants