Working with multiple blueprint files
This document describes 4 different solutions to work APIs that consist of multiple blueprint files. Every of this solution work with all Apiary.io features but editing. To edit a blueprint you have to do it outside of Apiary as Apiary editor does not support working with multiple files. In other words if you are using one of the solutions below avoid editing the blueprint in Apiary.
Hercule is a CLI tool written in Node.js – available as an NPM package. It uses markdown referencing and linking syntax to transclude other files into a blueprint file. This solution is universal and would work with any Markdown files not just API Blueprint.
The major benefit – unlike any other solutions here – is also that the references are rendered as HTML links in any Markdown editor so the result is HTML that can be browsed!
The syntax used in Hercule is the closest to the official API Blueprint referencing syntax as proposed at https://github.com/apiaryio/api-blueprint/issues/8 and https://github.com/apiaryio/api-blueprint/issues/20.
# Gist Fox API # Group Gist :[Gist](blueprint/gist.apib) :[Gists](blueprint/gists.apib)
Aglio is very popular static-site renderer for API Blueprint. It came with its very own transclusion syntax utilizing HTML comments. As a downside, if you render this as a plain Markdown (e.g. on GitHub) the references will disapear.
# Gist Fox API # Group Gist <!-- include(blueprint/gist.apib) --> <!-- include(blueprint/gists.apib) -->
3. Grunt task
A node.js grunt task that concatenates files into the
apiary.apib . It can also push – publish – the blueprint into Apiary.
4. Apiary manifest
Alpha-quality tool developed by Apiary. Working only with Apiary GitHub integration. Works similarly to Grunt task however you have to explicitly enumerate files to be concatenate in the
apiary.manifest file. This manifest file must be in the root of your repository. It is recommended to NOT use
apiary.apib file with this solution.
api_intro.apib blueprint/gist.apib blueprint/gists.apib
Personally I endorse the Hercule and it is syntax mainly because that solution works event without the Hercule tool. The Hercule syntax is also the closest to the one proposed for API Blueprint.
The most popular one at this moment is probably the syntax introduced in Aglio.
Concatenation solutions (Grunt task and Apiary manifest) feels simple but very limiting.