Search code examples
apiapiblueprintapiary.io

API blueprint (e.g.: Apiary) - tool to generate json body from blueprint


Is there a tool to help in making example JSON bodies from the API blueprint syntax?

For example if I have laid out the attributes like this:

+ Attributes (object)
    + data (array)
        + (object)
            + id: 100 (number) - The ID for the particular EPG object
            + title: "Vikings" (string) - The title for the program item
            + lang: "English" (string) - The language that the program is in
            + desc: "Lorem ipsum" (string) - The long description
            + start: 1492700179 (number) - The UNIX epoch timestamp for when the program starts
            + duration: 2816 (number) - For how many seconds the program will last
            + links (array)
                + (object)
                    + rel: "self",
                    + uri: "/epg/100"
                + (object)
                    + rel: "image"
                    + uri: "http://cdn.inquisitr.com/wp-content/uploads/2017/02/Vikings-Season-5-1.jpg"

Is there a tool that will generate a JSON body or schema for me from this? I have googled and looked through the tools at https://apiblueprint.org/tools.html but none of them seem suitable.


Solution

  • The API Blueprint parser is able to generate a JSON schema for your MSON data structures, it is just matter of extracting them from the parse result.

    You can do it manually but there are as well ready to use tools to do that.

    Hope it clarifies - I'll make sure to update the tools section!