added handling child lists
For now, the library does not parse child lists and leave them in this format:
{'main_list': [{'child_list[0]': {'property-name': 'example0'}, 'child_list[1]': {'property-name': 'example1'}}]}
This PR will change the result dictionary to the next format:
{'main_list': [{'child_list': [{'property-name': 'example0'}, {'property-name': 'example1'}]}
@joul87,
Thank you for your contribution.
Could you share an example in YAML format for the result that you shared in this PR?
I would like to include the example in this repository: https://github.com/amenezes/spring_config
@joul87,
Thank you for your contribution.
Could you share an example in YAML format for the result that you shared in this PR?
I would like to include the example in this repository: https://github.com/amenezes/spring_config
Hello Sure. The config file has the following structure:
environments:
- type: dev
properties:
- name: property1
schema:
type: string
minLength: 1
- name: property2
schema:
type: string
- type: stage
properties:
- name: property1
schema:
type: string
Also, I would like to ask you to re-run the tests for my commit. They were not completed due to Rate limit reached. I'm pretty sure it is not related to my changes.
@joul87,
Really sorry for delay.
But I have some doubts. I'm include the configuration that you shared with me and I tried reproduce the behavior related in the first comment, but using the command line option and the output, initially, make sense.
For example:
$ python -m config client simpleweb000 -f environments
╭────────────────────────────────────────────────── report for filter: 'environments' ───────────────────────────────────────────────────╮
│ [ │
│ { │
│ "properties": [ │
│ { │
│ "name": "property1", │
│ "schema": { │
│ "minLength": 1, │
│ "type": "string" │
│ } │
│ }, │
│ { │
│ "name": "property2", │
│ "schema": { │
│ "type": "string" │
│ } │
│ } │
│ ], │
│ "type": "dev" │
│ }, │
│ { │
│ "properties": [ │
│ { │
│ "name": "property1", │
│ "schema": { │
│ "type": "string" │
│ } │
│ } │
│ ], │
│ "type": "stage" │
│ } │
│ ] │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
$ python -m config client simpleweb000 -f environments.0.properties
╭──────────────────────────────────────────── report for filter: 'environments.0.properties' ────────────────────────────────────────────╮
│ [ │
│ { │
│ "name": "property1", │
│ "schema": { │
│ "minLength": 1, │
│ "type": "string" │
│ } │
│ }, │
│ { │
│ "name": "property2", │
│ "schema": { │
│ "type": "string" │
│ } │
│ } │
│ ] │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
Could you share some more examples with me using the config-server running as the example below:
docker run -it --rm -p 8888:8888 \
hyness/spring-cloud-config-server:3.1.0-jre17 \
--spring.cloud.config.server.git.uri=https://github.com/amenezes/spring_config
Hi guys ! Any idea if this issue could be handled soon ? It would be great for us to have this feature working asap @joul87 do you need help to finish your work ?
Hello, @amenezes
I'm so sorry for delay.
I have another output. I used command to start docker:
docker run -v ~/conf:/tmp/conf -it --rm -p 8888:8888 hyness/spring-cloud-config-server:3.1.0-jre17 --spring.cloud.config.server.native.searchLocations=/tmp/conf --spring.profiles.active=native
Conf directory:
{0} joul87[~/conf]: ls -1
simpleweb000.yml
{0} joul87[~/conf]: cat simpleweb000.yml
environments:
- type: dev
properties:
- name: property1
schema:
type: string
minLength: 1
- name: property2
schema:
type: string
- type: stage
properties:
- name: property1
schema:
type: string
Result:
(config_client) {0} joul87[/tmp/config_client]: python -m config client simpleweb000 -f environments.0
╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────── report for filter: 'environments.0' ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ { │
│ "properties[0]": { │
│ "name": "property1", │
│ "schema": { │
│ "minLength": 1, │
│ "type": "string" │
│ } │
│ }, │
│ "properties[1]": { │
│ "name": "property2", │
│ "schema": { │
│ "type": "string" │
│ } │
│ }, │
│ "type": "dev" │
│ } │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
(config_client) {0} joul87[/tmp/config_client]: pip freeze | grep config-client
config-client==1.4.0