apitome icon indicating copy to clipboard operation
apitome copied to clipboard

Allow multiple doc paths

Open andyhite opened this issue 10 years ago • 12 comments

This pull request adds the ability to specify multiple doc paths. This is useful when you have multiple groups of documentation generated by RAD, for instance when your API has multiple versions, or both a public and private API.

If the config.doc_path value is a string, then Apitome will function as it always has - by default, it will load docs from doc/api when accessing http://localhost:3000/api/docs. However, config.doc_path can also be set to a Hash with keys that map to group names and values that map to each group's unique RAD doc_path.

For example, with the following configuration:

Apitome.setup do |config|
  ...

  config.doc_path = { default: 'doc/api', v2: 'doc/api/v2', v3: 'doc/api/v3' }
end

The following paths are accessible:

http://localhost:3000/api/docs # this gets docs from ./doc/api
http://localhost:3000/api/docs/v2 # this gets docs from ./doc/api/v2
http://localhost:3000/api/docs/v3 # this gets docs from ./doc/api/v3

To default the "all docs" path to the most recent version of documentation, you could set default to doc/api/v3.

The routes generated for the documentation mirror the additional doc paths that are specified, so rake routes will show all versions specified in the Apitome configuration.

andyhite avatar Apr 12 '16 19:04 andyhite

nice!

acrogenesis avatar Apr 14 '16 02:04 acrogenesis

This would be great to see added, any idea why the build breaks?

rpocklin avatar May 26 '16 07:05 rpocklin

Can anyone confirm that this branch is working? I don't have time to look into what's up with CI this weekend.

jejacks0n avatar Aug 06 '16 19:08 jejacks0n

@jejacks0n something is wrong with travis here. I've merged this PR to my own fork and it works as expected. Running rspec or rake does not give any output, except a warning about SimpleCov.

It would be awesome if you could get this in to apitome. Let me know if I can help out further.

ariejan avatar Jan 27 '17 10:01 ariejan

Plans to have this merged?

rafaelsales avatar Apr 13 '17 16:04 rafaelsales

I'll rebase this and see if maybe the CI passes this time...

andyhite avatar Apr 13 '17 16:04 andyhite

The test seems to be failing because the CodeClimate test reporter is deprecated. That's...silly. I'm removing that to see if the specs actually pass, and leave it up to the maintainer to decide if it's okay to merge with the removed test reporter.

andyhite avatar Apr 13 '17 16:04 andyhite

Now it looks like there's missing dependencies for the tests...this appears to be an issue in master. I'm getting the feeling that this is an abandoned project, judging by the commit history and pending ignored pull requests. @jejacks0n is this library being maintained?

andyhite avatar Apr 13 '17 17:04 andyhite

A bit. I'm using it at the moment, and so might do some things with it. I wasn't using it for a while, and so was leaving it up to the community.

jejacks0n avatar Apr 13 '17 19:04 jejacks0n

@jejacks0n yeah, I know how it goes. If we can get the tests passing on the master branch, there's a few pending pull requests that the lib could benefit from.

andyhite avatar Apr 13 '17 19:04 andyhite

Nice work on this! I would love to see this merged, but it seems things have gone a bit stale around here. Is anyone actively maintaining this repo and servicing PRs? It's easy enough to use other forks, but that's hard to maintain in the long run. @jejacks0n, are you open to servicing PRs like this one or adding contributors who have availability to do so?

jsmartt avatar Sep 20 '17 16:09 jsmartt

I don't have a lot of spare time at the moment, but @jsmartt, you're welcome to jump in and get freshen things up. =) Thanks for the offer, and yeah, sometimes there's time and sometimes there's not -- thanks for understanding.

jejacks0n avatar Sep 21 '17 18:09 jejacks0n