zero-rails_openapi
zero-rails_openapi copied to clipboard
Issues with two routes referencing the same controller method
One issue we encountered was when two routes are pointing to the same Controller method.
E.g.
GET /api/posts
GET /api/users/{user-id}/posts
Which point to controller
class API::PostsController
def index
posts = policy_scope(Post)
posts = posts.where(user_id: params[:user_id]) if params[:user_id].present?
render posts.as_json
end
end
And API Docs
class API::PostsDoc < ApiDoc
route_base 'api/posts'
api :index, "Get Posts" do
..
end
end
So far we haven't found a way to write the definition that generates the correct docs for both endpoints at the same time
Did you figure out a solution to this?