Skip to content

alikh31/snowcrash

 
 

Repository files navigation

logo

Snow Crash Build Status

API Blueprint Parser

Snow Crash is the reference API Blueprint parser built on top of the Sundown Markdown parser.

API Blueprint is Web API documentation language. You can find API Blueprint documentation on the API Blueprint site.

Status

Install

OS X using Homebrew:

$ brew install --HEAD \
  https://raw.github.com/apiaryio/snowcrash/master/tools/homebrew/snowcrash.rb

Other systems refer to build notes.

Use

C++ library

#include "snowcrash.h"

mdp::ByteBuffer blueprint = R"(
# My API
## GET /message
+ Response 200 (text/plain)

        Hello World!
)";

snowcrash::ParseResult<snowcrash::Blueprint> ast;
snowcrash::parse(blueprint, 0, ast);

std::cout << "API Name: " << ast.node.name << std::endl;

Refer to Blueprint.h for the details about the Snow Crash AST and BlueprintSourcemap.h for details about Source Maps tree. See Snow Crash bindings for using the library in other languages.

Command line tool

$ cat << 'EOF' > blueprint.apib
# My API
## GET /message
+ Response 200 (text/plain)

        Hello World!
EOF

$ snowcrash blueprint.apib 
_version: 2.1
metadata:
name: "My API"
 ...

Refer to AST Serialization Media Types for the details on serialized media types. See parse feature for the details on using the snowcrash command line tool.

Build

  1. Clone the repo + fetch the submodules:

    $ git clone --recursive git://github.com/apiaryio/snowcrash.git
    $ cd snowcrash
  2. Build & test Snow Crash:

    $ ./configure
    $ make test

    To include integration tests (using Cucumber) use the --include-integration-tests flag:

    $ ./configure --include-integration-tests
    $ make test

We love Windows too! Please refer to Building on Windows.

Snow Crash command line tool

  1. Build snowcrash:

    $ make snowcrash
  2. Install & use snowcrash:

    $ sudo make install
    $ snowcrash --help

Bindings

Snow Crash bindings in other languages:

Contribute

Fork & Pull Request

If you want to create a binding for Snow Crash please refer to the Writing a Binding article.

License

MIT License. See the LICENSE file.

About

API Blueprint Parser

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 71.2%
  • C 26.8%
  • Other 2.0%