Skip to content

Issues with two routes referencing the same controller method #78

@fatigue-science

Description

@fatigue-science

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions