小编Sté*_*sin的帖子

如何在API BluePrint的模式中重用对象?

我创建了一个API,提供名为"Thumbnail"的资源(/缩略图)

{
    "name": "toto",
    "uri": "http://xxx"
}
Run Code Online (Sandbox Code Playgroud)

另一方面,我有多个资源,其中包含缩略图资源(如/ articles,/ videos ...):

{
    "name": "playlist",
    "thumbnail": 
    {
        "name": "toto",
        "uri": "http://xxx"
    }
}
Run Code Online (Sandbox Code Playgroud)

当我在BluePrint markdown中编写这些web服务的模式时,我希望能够重用我为Thumbnail模式创建的模式,以便不重复模式中的代码.我对Trait功能很感兴趣(https://github.com/apiaryio/api-blueprint/issues/47),但我不知道它是否符合我的需求,是否适用于aglio和dredd.

你知道在我的情况下做的最好的事情吗?

markdown apiary.io apiblueprint dredd aglio

6
推荐指数
1
解决办法
2244
查看次数

标签 统计

aglio ×1

apiary.io ×1

apiblueprint ×1

dredd ×1

markdown ×1