b-gran/object-editor-react

array of values do not appear

MareoRaft opened this issue · 3 comments

I believe this is the same or closely related to issue #6 . That issue was closed but I am not sure why.

Consider the schema:

const schema = {
  publicUserProperties: SchemaTypes.arrayOf({
    nested: SchemaTypes.string()
  }),
      (and a few more...)
}

and the object:

{
  "publicUserProperties": [
    "username",
    "givenname",
    "surname",
      (and a few more...)
  ],
}

This gives me the GUI:

Screenshot 2019-06-19 16 06 16

Instead of seeing the strings in the object, I see whitespace. How can I get the strings to appear correctly in the GUI?

Hi @MareoRaft,

The object doesn't match the schema in your example:
object

{
  "publicUserProperties": [
    "username",
    "givenname",
    "surname",
  ],
}

This object should have the following schema:

{
  publicUserProperties: SchemaTypes.arrayOf(SchemaTypes.string()),
}

I think you should do:
publicUserProperties: SchemaTypes.arrayOf({ nested: SchemaTypes.string() })()
It's like the return of arrayOf is immediately getting invoked. Maybe it's being documented but I missed it too, checked in the example.

@b-gran I'm pretty sure that did resolve my issue. Thanks.