Skip to content

Nested arrays not finding data to render #994

Closed
@clayroach

Description

@clayroach

I have replicated this on my own fork

First one is broken where "firstarray" is an array. 2nd one works where "firstarray" is an object.

//JSON
const broken = {
  "firstarray": [
    {
      "objectarrayofstrings": {
        "choices": [
          "CHOICE_STRING_1",
          "CHOICE_STRING_2",
          "CHOICE_STRING_3"
        ]
      }
    }
  ]
}

// Schema
{
  "type": "object",
  "properties": {
    "firstarray": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "objectarrayofstrings": {
            "type": "object",
            "properties": {
              "choices": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    }
  }
}

// UI Schema
{
  "type": "HorizontalLayout",
  "elements": [
    {
      "type": "Control",
      "label": "1",
      "scope": "#/properties/firstarray/items/properties/objectarrayofstrings/properties/choices"
    }
  ]
}


screen shot 2018-06-01 at 4 25 28 pm

// JSON
const works = {
  "firstarray": {
    "objectarrayofstrings": {
      "choices": [
        "CHOICE_STRING_1",
        "CHOICE_STRING_2",
        "CHOICE_STRING_3"
      ]
    }
  }
}

// Schema
{
  "type": "object",
  "properties": {
    "firstarray": {
      "type": "object",
      "properties": {
        "objectarrayofstrings": {
          "type": "object",
          "properties": {
            "choices": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          }
        }
      }
    }
  }
}

//UI Schema
{
  "type": "HorizontalLayout",
  "elements": [
    {
      "type": "Control",
      "label": "1",
      "scope": "#/properties/firstarray/properties/objectarrayofstrings/properties/choices"
    }
  ]
}

screen shot 2018-06-01 at 4 26 53 pm

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions