rero / ng-core

Angular library for Invenio
4 stars 12 forks source link

oneOf with array do not load data correctly #449

Closed jma closed 2 years ago

jma commented 3 years ago

Describe the issue When a oneOf contains an array with minItems the editor do not load existing data correctly.

To Reproduce

Try the editor with the given JSONSchema:

{
  "schema": {
    "type": "object",
    "oneOf": [
      {
        "title": "Boolean",
        "properties": {
          "bool": {
            "title": "Bool",
            "type": "boolean"
          }
        },
        "required": ["bool"]
      },
      {
        "title": "List",
        "properties": {
          "list": {
            "title": "List",
            "type": "array",
            "minItems": 1,
            "items": {
              "title": "Item",
              "type": "string"
            }
          }
        },
        "required": ["ipsum"]
      }
    ]
  },
  "model": {
    "list": ["test"]
  }
}

Expected behavior The list should be selected on the editor load.

Note: This problem correspond to an ngx-formly issue: https://github.com/ngx-formly/ngx-formly/issues/3059.