f5devcentral / vscode-f5

Let the F5 VSCode extension supercharge your workflows with schema validation, rest client, fast templates, and so much more!!!
https://f5devcentral.github.io/vscode-f5/#/
Apache License 2.0
57 stars 14 forks source link

Rendering array in FAST produces incorrect JSON array #236

Open leonseng opened 11 months ago

leonseng commented 11 months ago

Version: v3.15.0

Rendering "serverAddresses": {{server_addresses::array}} in FAST using Render Fast Template HTML Preview results in "serverAddresses": 10.1.20.10,10.1.20.11 - missing square brackets and double quotes

Expected result: "serverAddresses": ["10.1.20.10","10.1.20.11"]

image

Sample FAST

title: Simple HTTP Application
description: Simple HTTP load balancer using the same port on client and server side.
parameters:
  tenant_name: tophttp
  application_name: defaultsHTTP_8080
  virtual_address: 10.0.0.200
  virtual_port: 8080
  server_addresses:
    - 10.1.20.10
    - 10.1.20.11
  service_port: 80
template: |
  {
    "class": "ADC",
    "schemaVersion": "3.20.0",
    "{{tenant_name}}": {
      "class": "Tenant",
      "{{application_name}}": {
        "class": "Application",
        "template": "http",
        "serviceMain": {
          "class": "Service_HTTP",
          "virtualAddresses": [
            "{{virtual_address}}"
          ],
          "virtualPort": {{virtual_port}},
          "pool": "{{application_name}}_Pool1"
        },
        "{{application_name}}_Pool1": {
          "class": "Pool",
          "monitors": [
            "icmp"
          ],
          "members": [
            {
              "serverAddresses": {{server_addresses::array}},
              "servicePort": {{service_port}}
            }
          ]
        }
      }
    }
  }

Resulting AS3 JSON

{
  "class": "ADC",
  "schemaVersion": "3.20.0",
  "tophttp": {
    "class": "Tenant",
    "defaultsHTTP_8080": {
      "class": "Application",
      "template": "http",
      "serviceMain": {
        "class": "Service_HTTP",
        "virtualAddresses": [
          "10.0.0.200"
        ],
        "virtualPort": 8080,
        "pool": "defaultsHTTP_8080_Pool1"
      },
      "defaultsHTTP_8080_Pool1": {
        "class": "Pool",
        "monitors": [
          "icmp"
        ],
        "members": [
          {
            "serverAddresses": 10.1.20.10,10.1.20.11,
            "servicePort": 80
          }
        ]
      }
    }
  }
}