spring-cloud / spring-cloud/spring-cloud-config

Multi level arrays bug, cast array to map

Open
#1,759 1 comment 0 reactions 1 assignee View on GitHub

@ryanjbaxter is already working on this.

Since Nov 30, 2020.

bug
Dominant language
Java
Stars
2k
Forks
1.3k
Avg merge
2d 59m
Merged PRs (30d)
16

Description

Describe the bug
When I use a multilevel arrays structure in yaml config and call a json rest I've got a casting bug, it's map instead of array.

Sample
I've got a next yml config:

some-info:
  description: Example of bug
  supported-clients: client1, client2
  clients:
    client1:
      some-number: 0.123
      some-string: TEXT
      some-custom-format:
        client1-params:
          operation-params:
            - codes: c1, c2, c3, c4
              responses:
                  - type: typeA
                    response: "response A"
                  - type: typeB
                    response: "response B"
                  - type: typeC
                    response: "response C"
              default-response: "response D"
            - codes: c5
              response: "response E"

So here we got a map config with a list in section operation-params and in it's first element, in section responses. But in fact we got a map in responses, I think it makes in EnvironmentController

I waiting in json result a response with array like:

...
   "responses": [
     {...},
     {...},
     {...}
   ]
...

but got a:

...
   "responses": {
      "0": {
         "response": "response A",
         "type": "typeA"
      },
      "1": {
         "response": "response B",
         "type": "typeB"
      },
      "2": {
         "response": "response C",
         "type": "typeC"
      }
   }
...

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.