Синтаксис One Of
в этом конкретном примере помещает буквенные строки PollResponse
и XResponse
в One Of, вы можете использовать Include
, чтобы указать, что вы хотите включить конкретную ссылку.
## EntitiesResponse (object)
+ One Of
+ Include PollResponse (fixed-type)
+ Include XResponse (fixed-type)
В Attributes Kit есть ошибка, которая является компонентом, который Apiary использует для визуализации таблицы атрибутов.Ошибка возникает при использовании ссылок таким образом, я уже сообщал об этом как https://github.com/apiaryio/attributes-kit/issues/487.
Если вы посмотрите на схему JSON, сгенерированную синтаксическим анализатором (и представленную на пасеке), я считаю, что это правильно изВаше намерение (если вы считаете, что это неправильно, средство отслеживания проблем http://github.com/apiaryio/drafter/issues можно использовать для отслеживания ошибок в генерации схемы JSON):
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"message": {
"type": "string"
},
"response": {
"type": "object",
"properties": {
"total_count": {
"type": "string"
},
"response_count": {
"type": "number"
},
"data": {
"type": "array",
"items": {
"anyOf": [
{
"type": "object",
"properties": {
"unique_id": {
"type": "string"
},
"platform_id": {
"type": "string"
},
"url": {
"type": "string"
},
"date": {
"type": "string"
},
"first_fetch_time": {
"type": "string"
},
"publish_time": {
"type": "string"
},
"visit": {
"type": "number"
},
"deleted": {
"type": "boolean"
},
"content": {
"type": "object",
"properties": {
"md": {
"type": "string"
},
"raw_text": {
"type": "string"
},
"processed_text": {
"type": "string"
},
"media": {
"type": "array",
"items": {
"anyOf": [
{
"type": "object",
"properties": {
"completed": {
"type": "boolean"
},
"is_supported": {
"type": "boolean"
},
"cdn_url": {
"type": "string"
},
"backup_url": {
"type": "string"
},
"type": {
"enum": [
"photo",
"sticker",
"video",
"round_video",
"gif",
"voice",
"file"
]
},
"ext": {
"type": "string"
},
"metadata": {
"type": "object",
"properties": {
"size": {
"type": "number"
},
"width": {
"type": "number"
},
"height": {
"type": "number"
},
"duration": {
"type": "number"
}
},
"required": [
"size",
"width",
"height"
]
}
},
"required": [
"completed",
"is_supported",
"cdn_url",
"backup_url",
"type",
"ext",
"metadata"
]
}
]
}
},
"entities": {
"type": "array",
"items": {
"anyOf": [
{
"type": "object",
"allOf": [
{
"oneOf": [
{
"properties": {
"question": {
"type": "string"
},
"type": {
"enum": [
"anonymous poll",
"public poll"
]
},
"options": {
"type": "array"
}
},
"required": [
"question",
"type",
"options"
]
},
{
"properties": {
"question": {
"type": "string"
},
"type": {
"enum": [
"anonymous poll",
"public poll"
]
},
"options": {
"type": "array"
}
},
"required": [
"question",
"type",
"options"
]
}
]
}
]
}
]
}
}
},
"required": [
"md",
"raw_text",
"processed_text",
"media",
"entities"
]
},
"channel": {
"type": "object",
"properties": {
"platform_id": {
"type": "string"
},
"username": {
"type": "string"
},
"priority": {
"type": "number"
},
"url": {
"type": "string"
},
"title": {
"type": "string"
},
"description": {
"type": "string"
},
"members": {
"type": "number"
},
"profile_photo": {
"type": "object",
"properties": {
"completed": {
"type": "boolean"
},
"cdn_url": {
"type": "string"
},
"backup_url": {
"type": "string"
},
"ext": {
"type": "string"
},
"metadata": {
"type": "object",
"properties": {
"size": {
"type": "number"
},
"width": {
"type": "number"
},
"height": {
"type": "number"
}
},
"required": [
"size",
"width",
"height"
]
}
},
"required": [
"completed",
"cdn_url",
"backup_url",
"ext",
"metadata"
],
"additionalProperties": false
}
},
"required": [
"platform_id",
"username",
"priority",
"url",
"title",
"description",
"members",
"profile_photo"
]
}
},
"required": [
"unique_id",
"platform_id",
"url",
"date",
"first_fetch_time",
"publish_time",
"visit",
"deleted",
"content",
"channel"
]
}
]
}
}
},
"required": [
"total_count",
"response_count",
"data"
],
"additionalProperties": false
}
},
"required": [
"message",
"response"
]
}
Я хотел бы отметить, что Aglio использует многоболее старая версия синтаксического анализатора API Blueprint и, следовательно, создает очень разные схемы JSON.