Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alexdenisov/grape_doc
https://github.com/alexdenisov/grape_doc
Last synced: 12 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/alexdenisov/grape_doc
- Owner: AlexDenisov
- License: mit
- Created: 2012-08-15T07:16:53.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2015-11-30T16:50:56.000Z (almost 9 years ago)
- Last Synced: 2024-04-26T14:45:40.036Z (7 months ago)
- Language: Ruby
- Size: 191 KB
- Stars: 13
- Watchers: 5
- Forks: 13
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# 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 exampleIt'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