记录一个用Yard呈现JSON的函数?

时间:2014-06-04 21:58:40

标签: ruby-on-rails ruby yard

如果我有一个返回此功能的函数:

render :json => @orders.as_json(include: [{:user => {only: :id}}], :only => [:id, :status_id])

我正在记录它:

 # @return [JSON] includes the id, the order status id and the id of the associated user

我想知道是否有更好的方法来记录返回的JSON的样子。

1 个答案:

答案 0 :(得分:0)

因此,如果你关心API的文档,我认为你也关心测试,所以你的API端点可能有测试。我建议您使用Rspec API Documentation。如果您目前没有使用Rspec,我会尝试Apipie。这两个工具都有助于确保您的API文档保持一致并保持最新。