注意
Issue 表单目前处于公开预览阶段,可能会发生更改。
缺少必需的顶级键 name
模板不包含 name 字段,这意味着在向用户提供选项列表时,不清楚如何命名 Issue 模板。
“缺少必需的顶级键 name”错误示例
description: "Thank you for reporting a bug!"
...
可以通过将 name 添加为键来修复此错误。
name: "Bug report"
description: "Thank you for reporting a bug!"
...
key 必须是字符串
此错误消息表示已提供允许的键,但其值无法解析,因为不支持其数据类型。
“key 必须是字符串”错误示例
下面的 description 正在被解析为布尔值,但它应该是字符串。
name: "Bug report"
description: true
...
可以通过提供字符串作为值来修复此错误。字符串可能需要用双引号括起来才能成功解析。例如,包含 ' 的字符串必须用双引号括起来。
name: "Bug report"
description: "true"
...
当字段需要字符串时,空字符串或仅包含空格的字符串也不允许。
name: ""
description: "File a bug report"
assignees: " "
...
可以通过将值更正为非空字符串来修复此错误。如果该字段不是必需的,则应删除键值对。
name: "Bug Report"
description: "File a bug report"
...
input 不是允许的键
在模板的顶级提供了意外的键。有关支持哪些顶级键的更多信息,请参阅“Issue 表单的语法”。
“input 不是允许的键”错误示例
name: "Bug report"
hello: world
...
可以通过删除意外的键来修复此错误。
name: "Bug report"
...
禁止的键
YAML 将某些字符串解析为 Boolean 值。为避免这种情况,我们明确禁止使用以下键
y、Y、yes、Yes、YES、n、N、no、No、NO、true、True、TRUE、false、False、FALSE、on、On、ON、off、Off、OFF
可以通过删除禁止的键来修复此错误。
正文必须包含至少一个非 Markdown 字段
Issue 表单必须接受用户输入,这意味着其字段中至少必须包含一个用户输入字段。markdown 元素是静态文本,因此 body 数组不能仅包含 markdown 元素。
“正文必须包含至少一个非 Markdown 字段”错误示例
name: "Bug report"
body:
- type: markdown
attributes:
value: "Bugs are the worst!"
可以通过添加接受用户输入的非 Markdown 元素来修复此错误。
name: "Bug report"
body:
- type: markdown
attributes:
value: "Bugs are the worst!"
- type: textarea
attributes:
label: "What's wrong?"
正文必须具有唯一的 ID
如果使用 id 属性来区分多个元素,则每个 id 属性都必须是唯一的。
“正文必须具有唯一的 ID”错误示例
name: "Bug report"
body:
- type: input
id: name
attributes:
label: First name
- type: input
id: name
attributes:
label: Last name
可以通过更改其中一个输入的 id 来修复此错误,以便每个 input 字段都具有唯一的 id 属性。
name: "Bug report"
body:
- type: input
id: name
attributes:
label: First name
- type: input
id: surname
attributes:
label: Last name
正文必须具有唯一的标签
当有多个 body 元素接受用户输入时,每个用户输入字段的 label 属性必须是唯一的。
“正文必须具有唯一的标签”错误示例
name: "Bug report"
body:
- type: textarea
attributes:
label: Name
- type: textarea
attributes:
label: Name
可以通过更改其中一个输入字段的 label 属性来修复此错误,以确保每个 label 都是唯一的。
name: "Bug report"
body:
- type: textarea
attributes:
label: Name
- type: textarea
attributes:
label: Operating System
输入字段也可以通过其 id 属性来区分。如果需要重复的 label 属性,则可以提供至少一个 id 来区分具有相同标签的两个元素。
name: "Bug report"
body:
- type: textarea
id: name_1
attributes:
label: Name
- type: textarea
id: name_2
attributes:
label: Name
id 属性在 Issue 正文中不可见。如果要区分结果 Issue 中的字段,则应使用不同的 label 属性。
标签过于相似
相似的标签可能会被处理成相同的引用。如果未为 input 提供 id 属性,则将使用 label 属性生成对 input 字段的引用。为此,我们将通过利用 Rails parameterize 方法来处理 label。在某些情况下,两个不同的标签可能会被处理成相同的参数化字符串。
“标签过于相似”错误示例
name: "Bug report"
body:
- type: input
attributes:
label: Name?
- type: input
id: name
attributes:
label: Name???????
可以通过向其中一个冲突的标签添加至少一个区分的字母数字字符、- 或 _ 来修复此错误。
name: "Bug report"
body:
- type: input
attributes:
label: Name?
- type: input
attributes:
label: Your name
也可以通过为其中一个冲突的标签提供唯一的 id 来修复此错误。
name: "Bug report"
body:
- type: input
attributes:
label: Name?
- type: input
id: your-name
attributes:
label: Name???????
复选框必须具有唯一的标签
当存在 checkboxes 元素时,其每个嵌套标签在其同级之间以及其他输入类型之间都必须是唯一的。
“复选框必须具有唯一标签”错误示例
name: "Bug report"
body:
- type: textarea
attributes:
label: Name
- type: checkboxes
attributes:
options:
- label: Name
可以通过更改其中一个输入的label属性来修复此错误。
name: "Bug report"
body:
- type: textarea
attributes:
label: Name
- type: checkboxes
attributes:
options:
- label: Your name
或者,您可以为任何冲突的顶级元素提供id。嵌套的复选框元素不支持id属性。
name: "Bug report"
body:
- type: textarea
id: name_1
attributes:
label: Name
- type: checkboxes
attributes:
options:
- label: Name
id 属性在 Issue 正文中不可见。如果要区分结果 Issue 中的字段,则应使用不同的 label 属性。
Body[i]:缺少必需的键类型
每个主体块都必须包含键type。
body的错误将以body[i]为前缀,其中i表示包含错误的主体块的零索引索引。例如,body[0]告诉我们错误是由body列表中的第一个块引起的。
“body[i]:缺少必需的键类型”错误示例
body:
- attributes:
value: "Thanks for taking the time to fill out this bug! If you need real-time help, join us on Discord."
可以通过添加键type并将有效输入类型作为值来修复此错误。有关可用的body输入类型及其语法,请参阅“GitHub 表单架构的语法”。
body:
- type: markdown
attributes:
value: "Thanks for taking the time to fill out this bug! If you need real-time help, join us on Discord."
Body[i]:x不是有效的输入类型
其中一个主体块包含一个类型值,该值不是允许的类型之一。
body的错误将以body[i]为前缀,其中i表示包含错误的主体块的索引。例如,body[0]告诉我们错误是由body列表中的第一个块引起的。
“body[i]:x不是有效的输入类型”错误示例
body:
- type: x
attributes:
value: "Thanks for taking the time to fill out this bug! If you need real-time help, join us on Discord."
可以通过将x更改为有效类型之一来修复此错误。
body:
- type: markdown
attributes:
value: "Thanks for taking the time to fill out this bug! If you need real-time help, join us on Discord."
Body[i]:缺少必需的属性键value
缺少其中一个必需的value属性。当块没有attributes键或在attributes键下没有value键时,就会发生此错误。
body的错误将以body[i]为前缀,其中i表示包含错误的主体块的索引。例如,body[0]告诉我们错误是由body列表中的第一个块引起的。
“body[i]:缺少必需的属性键value”错误示例
body:
- type: markdown
attributes:
value: "Thanks for taking the time to fill out this bug! If you need real-time help, join us on Discord."
- type: markdown
此示例中的错误可以通过在body的第二个列表元素中的attributes下添加value作为键来修复。
body:
- type: markdown
attributes:
value: "Thanks for taking the time to fill out this bug! If you need real-time help, join us on Discord."
- type: markdown
attributes:
value: "This is working now!"
Body[i]:标签必须是字符串
在其attributes块中,某个值的数据类型错误。
body的错误将以body[i]为前缀,其中i表示包含错误的主体块的索引。例如,body[0]告诉我们错误是由body列表中的第一个块引起的。
“body[i]:标签必须是字符串”错误示例
下面的label正在被解析为布尔值,但它应该是一个字符串。
body:
- type: markdown
attributes:
value: "Thanks for taking the time to fill out this bug! If you need real-time help, join us on Discord."
- type: textarea
attributes:
label: Bug Description
- type: textarea
attributes:
label: true
可以通过为label提供字符串值来修复此错误。如果您想使用可能被解析为布尔值、整数或小数的label值,则应将该值用引号括起来。例如,使用"true"或"1.3"而不是true或1.3。
- type: markdown
attributes:
value: "Thanks for taking the time to fill out this bug! If you need real-time help, join us on Discord."
- type: textarea
attributes:
label: Bug Description
- type: textarea
attributes:
label: Environment Details
当属性期望字符串时,不允许使用空字符串或仅包含空格的字符串。例如,不允许使用""或" "。
如果属性是必需的,则值必须是非空字符串。如果字段不是必需的,则应删除键值对。
body:
- type: input
attributes:
label: "Name"
Body[i]:id只能包含数字、字母、-、_
id属性只能包含字母数字字符、-和_。您的模板可能在id中包含非允许字符,例如空格。
body的错误将以body[i]为前缀,其中i表示包含错误的主体块的索引。例如,body[0]告诉我们错误是由body列表中的第一个块引起的。
“body[i]:id只能包含数字、字母、-、_”错误示例
name: "Bug report"
body:
- type: input
id: first name
attributes:
label: First name
可以通过确保从id值中删除空格和其他非允许字符来修复此错误。
name: "Bug report"
body:
- type: input
id: first-name
attributes:
label: First name
Body[i]:x不是允许的键
在与type和attributes相同的缩进级别提供了意外的键x。
body的错误将以body[i]为前缀,其中i表示包含错误的主体块的索引。例如,body[0]告诉我们错误是由body列表中的第一个块引起的。
“body[i]:x不是允许的键”错误示例
body:
- type: markdown
x: woof
attributes:
value: "Thanks for taking the time to fill out this bug! If you need real-time help, join us on Discord."
可以通过删除多余的键并仅使用type、attributes和id来修复此错误。
body:
- type: markdown
attributes:
value: "Thanks for taking the time to fill out this bug! If you need real-time help, join us on Discord."
Body[i]:label包含禁用词
为了最大程度地降低在 GitHub Issues 中公开发布私人信息和凭据的风险,某些攻击者常用的词语在输入或文本区域元素的label中是不允许的。
body的错误将以body[i]为前缀,其中i表示包含错误的主体块的索引。例如,body[0]告诉我们错误是由body列表中的第一个块引起的。
“body[i]:label包含禁用词”错误示例
body:
- type: markdown
attributes:
value: Hello world!
- type: input
attributes:
label: Password
可以通过从任何label字段中删除诸如“password”之类的术语来修复此错误。
body:
- type: markdown
attributes:
value: Hello world!
- type: input
attributes:
label: Username
Body[i]:x不是允许的属性
在attributes块中提供了无效的键。
body的错误将以body[i]为前缀,其中i表示包含错误的主体块的索引。例如,body[0]告诉我们错误是由body列表中的第一个块引起的。
“body[i]:x不是允许的属性”错误示例
body:
- type: markdown
attributes:
x: "a random key!"
value: "Thanks for taking the time to fill out this bug!"
可以通过删除多余的键并仅使用允许的属性来修复此错误。
body:
- type: markdown
attributes:
value: "Thanks for taking the time to fill out this bug!"
Body[i]:options必须唯一
对于复选框和下拉输入类型,在options数组中定义的选择必须唯一。
body的错误将以body[i]为前缀,其中i表示包含错误的主体块的索引。例如,body[0]告诉我们错误是由body列表中的第一个块引起的。
“body[i]:options必须唯一”错误示例
body:
- type: dropdown
attributes:
label: Favorite dessert
options:
- ice cream
- ice cream
- pie
可以通过确保options数组中不存在重复的选择来修复此错误。
body:
- type: dropdown
attributes:
label: Favorite dessert
options:
- ice cream
- pie
Body[i]:options不能包含保留字“none”
“None”是options集中的保留字,因为它用于在dropdown不是必需时指示非选择。
body的错误将以body[i]为前缀,其中i表示包含错误的主体块的索引。例如,body[0]告诉我们错误是由body列表中的第一个块引起的。
“body[i]:options不能包含保留字“none””错误示例
body:
- type: dropdown
attributes:
label: What types of pie do you like?
options:
- Steak & Ale
- Chicken & Leek
- None
validations:
required: true
可以通过删除“None”作为选项来修复此错误。如果您希望贡献者能够表明他们不喜欢这些类型的馅饼中的任何一种,您可以另外删除required验证。
body:
- type: dropdown
attributes:
label: What types of pie do you like?
options:
- Steak & Ale
- Chicken & Leek
在此示例中,“None”将自动填充为可选选项。
Body[i]:options不能包含布尔值。请将诸如“yes”和“true”之类的值用引号括起来
YAML 解析器会将许多英文单词处理成布尔值,除非它们用引号括起来。对于下拉options,所有项目都必须是字符串而不是布尔值。
body的错误将以body[i]为前缀,其中i表示包含错误的主体块的索引。例如,body[0]告诉我们错误是由body列表中的第一个块引起的。
“body[i]:options不能包含布尔值。请将诸如“yes”和“true”之类的值用引号括起来”错误示例
body:
- type: dropdown
attributes:
label: Do you like pie?
options:
- Yes
- No
- Maybe
可以通过将每个有问题的选项用引号括起来来修复此错误,以防止它们被处理为布尔值。
body:
- type: dropdown
attributes:
label: Do you like pie?
options:
- "Yes"
- "No"
- Maybe
Body 不能为空
模板主体key:value对不能为空。有关哪些顶级键是必需的,请参阅“问题表单的语法”。
可以通过添加body:部分来修复此错误。
“Body 不能为空”错误示例
name: Support Request
description: Something went wrong and you need help?
---
body:
- type: textarea
attributes:
label: "What's wrong?"
在此示例中,可以通过删除标题和body部分之间的---(文档分隔符)来修复此错误。
name: Support Request
description: Something went wrong and you need help?
body:
- type: textarea
attributes:
label: "What's wrong?"