This repository has been archived by the owner on Nov 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Developers
Z edited this page Dec 4, 2015
·
8 revisions
NOTE: This article is outdated, proceed with care.
It is best to consume the API Blueprint AST directly either via a binding interface or the native parser interface.
Alternatively, you can use the parser command line tool and then process its output AST media type.
-
Install binding for your language (e.g. Protagonist for Node.js)
$ npm install protagonist
-
Parse your API Blueprint into its AST
var protagonist = require('protagonist'); var blueprint = ''' # GET /message + Response 200 (text/plain) Hello World! '''; protagonist.parse(blueprint, function(err, result) { ... });
-
Get Snow Crash command line tool
$ brew install --HEAD \ https://raw.github.com/apiaryio/snowcrash/master/tools/homebrew/snowcrash.rb
-
Parse API Blueprint into its AST media type
$ cat << 'EOF' | snowcrash --format json # GET /message + Response 200 (text/plain) Hello World! EOF { "_version": "1.0", "metadata": {}, "name": "", "description": "", ...
-
Build Snow Crash
$ ./configure $ make
See full build instructions
-
Parse your API Blueprint into its AST
#include "snowcrash.h" snowcrash::SourceData blueprint = R"( # GET /message + Response 200 (text/plain) Hello World! )"; snowcrash::Result result; snowcrash::Blueprint ast; snowcrash::parse(blueprint, 0, result, ast); ...