Documenting a function that renders a JSON with Yard?
Asked Answered
J

1

7

If I have a function that returns this:

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

I am documenting it like this:

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

I am wondering if there is a better way of document how the returned JSON will look like.

Janka answered 4/6, 2014 at 21:58 Comment(1)
Did you find a better way?Lastex
H
-2

So if you care about the documentation of you API I assume that you also care about testing so your API end points probably have test. I would suggest that you using Rspec API Documentation. If you are not currently using Rspec I would give Apipie a try. Both of these tools will help to insure that your API documentation is consistent and stays up to date.

Huei answered 16/10, 2016 at 14:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.