spring-cloud-config icon indicating copy to clipboard operation
spring-cloud-config copied to clipboard

Multi level arrays bug, cast array to map

Open velykov opened this issue 4 years ago • 1 comments

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"
      }
   }
...

velykov avatar Nov 25 '20 05:11 velykov

I am not able to reproduce the issue. image Looks good as expected...

epm-dev-priporov avatar Dec 28 '20 14:12 epm-dev-priporov