7

I'm learning Angular Schematics and have some problems regarding array type input.

When I am prompted to enter a value and press enter the value disappears. What is the correct way of entering an array value?

enter image description here

My schema.json is the following:

{
    "$schema": "http://json-schema.org/schema",
    "id": "HelloWorldSchematics",
    "title": "Hello World Options Schema",
    "type": "object",
    "properties": {
      "listName": {
        "type": "string",
        "description": "The name of the list.",
        "$default": {
          "$source": "argv",
          "index": 0
        },
        "x-prompt": "What's the name of list"
      },
      "colNames": {
        "type": "array",
        "items": {
            "type": "string"
        },
        "description": "The name of the columns.",
        "x-prompt": "What's the name of columns"
      }
    },
    "required": [
        "listName",
        "colNames"
    ]
}
Leandro
  • 1,244
  • 16
  • 28
Andy Zhang
  • 153
  • 5

1 Answers1

0

I was only able to enter a value using the flag. Following your example, you can enter values like this:

schematics ./collection.json:HelloWorld --listName User --colNames={id,firstName}

Notice that there is no space between the elements of the array.

The following WOULD NOT WORK:

schematics ./collection.json:HelloWorld --listName User --colNames={id, firstName}
Leandro
  • 1,244
  • 16
  • 28