gpt4 book ai didi

Angular Schematics 提示数组类型

转载 作者:行者123 更新时间:2023-12-04 01:44:49 26 4
gpt4 key购买 nike

在设置我的原理图时,我看到我可以提示输入以下任何类型 String | bool 值 |数组 |号码 |整数 |空 |目的。

我正在尝试设置一个示意图,提示用户从可用模块列表中选择一个模块。因此,例如,用户会看到如下内容:

What module are you adding this store to?
> Foo
Bar
Baz

虽然有大量字符串和 bool 提示的示例,但没有人提供我为数组提示找到的示例。对于我的一生,我无法弄清楚如何在数组中提供选项以提示用户从中进行选择,而这根本不会出现在他们的文档中。
{
"$schema": "http://json-schema.org/schema",
"id": "SchematicsIDXStoreGen",
"title": "IDX Store Gen Schema",
"type": "object",
"properties": {
"featureName": {
"type": "string",
"description": "The name of the store",
"x-prompt": "What is the name of the store you'd like to create"
},
"module": {
"type": "array",
"description": "Select the appropriate module",
"x-prompt": "What module are you adding this store to?" // I want to provide a list of available modules here.
}
},
"required": ["featureName", "module"]
}

最佳答案

您可以尝试以下方法,也可以检查适合您的选项。

"modules": {
"type": "array",
"description": "description",
"uniqueItems": true,
"items": {
"type": "string"
},
"x-prompt": {
"message": "Which module would you like to select?",
"type": "list",
"multiselect": true,
"items": [
"firstOption",
"secondOption",
"thirdOption"
]
}
}

关于Angular Schematics 提示数组类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55735095/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com