How to enter array type value for angular schematics
Asked Answered
A

1

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"
    ]
}
Accounting answered 8/4, 2019 at 6:31 Comment(1)
Did you find a solution ?Foible
V
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}
Valerlan answered 9/9, 2019 at 19:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.