@danilvalov嗨,Apiary 没有使用最新版本的 API Blueprint Parser,它增加了对可空性的支持。
Apiary 确实有一个用于改进属性呈现的测试版,其中包括对可空性的支持。 您可以在https://github.com/apiaryio/api-blueprint/issues/191#issuecomment -178044764 上找到有关测试版的更多信息以及如何加入它。
问候,
凯尔
我只想指出,它现在已经部署到 Apiary(没有测试版)。
例如,您可以使用 nullable,如下所示:
+ Response 200 (application/json)
+ Attributes
+ example1 (string, optional, nullable) - An example optional nullable string
+ example2: value (string, optional, nullable) - An example optional nullable string with a sample value
这将导致以下示例有效负载:
{
"example1": null,
"example2": "value"
}
连同以下 JSON 模式:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"example1": {
"type": [
"string",
"null"
],
"description": "An example optional nullable string"
},
"example2": {
"type": [
"string",
"null"
],
"description": "An example optional nullable string with a sample value"
}
}
}
Apiary 中的属性表
这现在在ApiaryUI 中可见:
最有用的评论
我只想指出,它现在已经部署到 Apiary(没有测试版)。
例如,您可以使用 nullable,如下所示:
这将导致以下示例有效负载:
连同以下 JSON 模式:
Apiary 中的属性表