Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with two routes referencing the same controller method #78

Open
fatigue-science opened this issue Sep 6, 2023 · 0 comments
Open

Comments

@fatigue-science
Copy link

fatigue-science commented Sep 6, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant