Ruby on rails 记录用Yard呈现JSON的函数?

Ruby on rails 记录用Yard呈现JSON的函数?,ruby-on-rails,ruby,yard,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的外观。因此,如果您关心A

如果我有一个函数返回:

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的外观。

因此,如果您关心API的文档,我假设您也关心测试,因此您的API端点可能有测试。我建议你使用。如果您当前没有使用Rspec,我会尝试一下。这两种工具都有助于确保API文档的一致性和最新性。

您找到更好的方法了吗?