No description, website, or topics provided.
Ruby Shell
Switch branches/tags
Nothing to show
Latest commit 2fcf159 Sep 11, 2015 @AlexDenisov AlexDenisov Merge pull request #7 from karloku/master
escape square brackets
Permalink
Failed to load latest commit information.
bin Missed sources added Aug 10, 2012
lib escape square brackets Sep 10, 2015
spec escape square brackets Sep 10, 2015
.gitignore Initial commit Aug 10, 2012
.rvmrc Fixed .rvmrc to use Ruby 1.9.3 instead of 1.9.2 Jun 3, 2014
CHANGELOG.md Merge develop branch Sep 10, 2012
Gemfile NonRails app support Sep 10, 2012
LICENSE
README.md
Rakefile Initial commit Aug 10, 2012
grape_doc.gemspec Add more authors Apr 17, 2015

README.md

GrapeDoc

This gem generate API documentation from Grape API.

Installation

Add this line to your application's Gemfile under development group

gem 'grape_doc'

And then execute:

$ bundle

Or install it yourself as:

$ gem install grape_doc

Usage

To generate API documentation you should cd to your app directory

$ cd app_dir

# rails
$ grape_doc

# non-rails
$ grape_doc --path sinatra_app.rb # for example

It'll generate documentation for each Grape::API subclass and place it into grape_doc directory. Each API subclass were placed as separated file.

You can pass a doc formatter as parameter

$ grape_doc

At this time it supports only MarkDown format.

API description

Parameters

grape > 0.2.1

desc "Returns a tweet."
params do
  requires :id, 
           :type => Integer, 
           :desc => "Tweet id."
end
get '/show/:id' do
  Tweet.find(params[:id])
end

grape <= 0.2.1

desc "Returns a tweet.",
:params => {
  :id => {
    :desc => "Tweet id.",
    :type => Integer,
    :requires => true
  }
}
get '/show/:id' do
  Tweet.find(params[:id])
end

TODO

  • generate plain response
  • generate response from Grape::Entity
  • generate response from Grape::Entity with nested entities
  • other output formats
  • write docs into separated files
  • add code documentation
  • and more others features

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request