Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added handling child lists #51

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

joul87
Copy link

@joul87 joul87 commented Jul 6, 2024

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 joul87 force-pushed the feature/child-lists branch from a26fd54 to 4f010d2 Compare July 8, 2024 12:09
@joul87 joul87 force-pushed the feature/child-lists branch from 4f010d2 to adadda2 Compare July 8, 2024 12:11
@amenezes
Copy link
Owner

@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
Copy link
Author

joul87 commented Jul 21, 2024

@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.

@amenezes
Copy link
Owner

amenezes commented Aug 8, 2024

@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

@Maassa
Copy link

Maassa commented Nov 28, 2024

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 ?

@joul87
Copy link
Author

joul87 commented Nov 29, 2024

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

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