Git Product home page Git Product logo

calamum's Introduction

calamum

Calamum is a simple tool to generate a REST API documentation from a JSON file definition.

Installation

Download and install calamum: gem install calamum

Usage

calamum -h
Usage: /bin/calamum (options)
  -d, --debug                      Show actions to do (true by default)
  -f, --file DEFINITION            Path to the file with API definition
  -p, --path PATH                  Path to the directory where docs will be generated
  -t, --template TEMPLATE          Name of HTML template (twitter or bootstrap , twitter by default)
  -s, --sort                       Sort the resources alphabetically
  -v, --version                    Show version number
  -h, --help                       Show this help

To generate a documentation you should write a definition of your REST API in JSON format or YAML format.
In the case of separated resources files, the resources attribute must define the directory path of resources files as in the files sample_separated.json and sample_separated.yml.
You could find an example of API definition in the sample.json and sample.yml. Next, just run the calamum command.

for twitter template:

$calamum -f my_api_definition.json -t twitter

for bootstrap template:

$calamum -f my_api_definition.json -t bootstrap

To preview just generated documentation, navigate to the 'docs' directory (by default in your home path, you can specify the destination path with the option '-p/--path'). Then, find and open the index.html file in your browser and enjoy the result.

Inspirations

calamum's People

Contributors

elthariel avatar fishnix avatar ingk avatar jgoodsen avatar knoxknox avatar malachheb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

calamum's Issues

Header in HTML tab

I have tried to add header by different ways but could not succeed, can you please tell me how can i added header to API documentation.

Accept: application/vnd.example.v1
Content-Type: application/json

"header": {
"Accept": {
"type": "string",
"description": "application/vnd.example.v1",
"required": true
},
"Content-Type": {
"type": "string",
"description": "application/json",
"required": true
}
},

enable -s won't sort resources based on the key values

In doc_parser.rb, we put each resource into a Hash.
Ln 5 "@resources = Hash.new"
then in the twitter template, we read it by
Ln 32 "<% @resources.each do |name, endpoints| %>"
which can't ensure read resources in sequence.

what about reading it by:

<% @resources.sort.map do |name, endpoints| %> ?

"Resources" are not consistently sorted

Because resources are stored as a dictionary, regenerating the documentation from the same YAML file does not result in consistent output. It would be nice if they remained in the same order across re-runs (alphabetically?).

POST json data

Can the description of a POST (or PUT) be a JSON document, instead of a set of params?

Return error

Run this command
calamum -f myapi.json -t twitter

return [ERROR] undefined method `each' for nil:NilClass

Resource Files

It would be interesting if this gem could also handle the resources in smaller files. For instance, if the resources could be separate json files.

Calamum appears to depend on pry but is not listed as a dependency

On a fresh RVM 1.9.3 install in Ubuntu 12.04 after running gem install calamum.

$> calamum
/home/vagrant/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- pry (LoadError)
        from /home/vagrant/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /home/vagrant/.rvm/gems/ruby-1.9.3-p484/gems/calamum-1.1.0/lib/calamum.rb:5:in `<top (required)>'
        from /home/vagrant/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /home/vagrant/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /home/vagrant/.rvm/gems/ruby-1.9.3-p484/gems/calamum-1.1.0/lib/calamum/runner.rb:1:in `<top (required)>'
        from /home/vagrant/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /home/vagrant/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /home/vagrant/.rvm/gems/ruby-1.9.3-p484/gems/calamum-1.1.0/bin/calamum:8:in `<top (required)>'
        from /home/vagrant/.rvm/gems/ruby-1.9.3-p484/bin/calamum:23:in `load'
        from /home/vagrant/.rvm/gems/ruby-1.9.3-p484/bin/calamum:23:in `<main>'
        from /home/vagrant/.rvm/gems/ruby-1.9.3-p484/bin/ruby_executable_hooks:15:in `eval'
        from /home/vagrant/.rvm/gems/ruby-1.9.3-p484/bin/ruby_executable_hooks:15:in `<main>'

After running gem install pry calamum works as expected.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.