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

Prefix for request paths #315

Open
kylemacey opened this issue Dec 5, 2016 · 2 comments
Open

Prefix for request paths #315

kylemacey opened this issue Dec 5, 2016 · 2 comments

Comments

@kylemacey
Copy link

We use an API that is connected to by specifying a version in the path /api/v1/users.

I'd like to simplify the way the documentation is generated, making it look a little cleaner by not always including api/v1 in each header. We can document how to specify a version in the root of the documentation

For example, I want to be able to write my tests like this:

get "/api/v1/users" do

But generate documentation that looks like this:

image

Maybe in the resource declaration, I could do

resource "Users", prefix: "/api/v1" do

Maybe even then, we could still use the shorthand for the requests?

resource "Users", prefix: "/api/v1" do
  get "/users" do

I'm not sure which makes more sense, or if there's already a way to do something like this.

@kurko
Copy link
Contributor

kurko commented Dec 6, 2016

I think the following would make sense.

get "/api/v1/users", name: "/users" do
  # ...
end

After #313 is merged, you'll be able to do:

get "/users", route_uri: "/api/v1/users" do
  # ...
end

@JakeDluhy
Copy link

I see #313 was merged, but I tried using route_uri (and name) and neither is working. Is there a way to rename an API path?

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

3 participants