【问题标题】:Different versions of API Blueprint不同版本的 API 蓝图
【发布时间】:2014-10-20 16:17:36
【问题描述】:

http://apiblueprint.org/#get-started 上示例的结构似乎与 APIary.io 上的结构不同。

谁能评论它们是否不同,如果不同,哪种结构是正确的?

例如,

API 蓝图文档结构

1.) 元数据 2.) API 名称和概述 3.) 资源 A.) URI 参数 B.) 型号 1.) 标题 2.) 身体 3.) 架构 C.) 行动 1.) URI 参数 2.) 请求 a.) 标题 b.) 身体 c.) 模式 3.) 回应 a.) 标题 b.) 身体 c.) 模式 4.) 资源组 A.) 资源

{
    "_version": "2.0",
    "metadata": [],
    "name": "",
    "description": "",
    "resourceGroups": [
        {
            "name": "",
            "description": "",
            "resources": [
                {
                    "name": "",
                    "description": "",
                    "uriTemplate": "/message",
                    "model": {},
                    "parameters": [],
                    "actions": [
                        {
                            "name": "",
                            "description": "",
                            "method": "GET",
                            "parameters": [],
                            "examples": [
                                {
                                    "name": "",
                                    "description": "",
                                    "requests": [],
                                    "responses": [
                                        {
                                            "name": "200",
                                            "description": "",
                                            "headers": [
                                                {
                                                    "name": "Content-Type",
                                                    "value": "text/plain"
                                                }
                                            ],
                                            "body": "Hello World!\n",
                                            "schema": ""
                                        }
                                    ]
                                }
                            ]
                        }
                    ]
                }
            ]
        }
    ]
}

非常感谢,

【问题讨论】:

    标签: apiblueprint


    【解决方案1】:

    您提到的“API 蓝图文档结构”是您编写 API 蓝图文档的方式。

    您在上面编写的 JSON 是您在使用 API 蓝图解析器(如 https://github.com/apiaryio/snowcrash)解析上述 API 蓝图时获得的 AST。

    因此,它们都正确地代表了您的 API 蓝图,但非 AST 的蓝图更具可读性。

    希望能消除您的困惑。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-02-24
      • 1970-01-01
      • 2012-09-27
      • 2020-12-26
      • 2016-07-28
      • 1970-01-01
      • 2013-04-01
      • 1970-01-01
      相关资源
      最近更新 更多