Skip to content
Code example generator tool for API Docs
Branch: master
Clone or download
svenlaater feature: template for response example (#24)
Added template, logic and tests to generate JSON file that
contains expected HTTP request response code and body.
Generated from RAML files.
Latest commit 6e97d12 Jul 17, 2019

Code Examples Generator

Build Status

The purpose of this project is to create a command line tool that is able to parse Platform of Trust API documentation and examples from RAML 1.0 files and generate example HTTP requests in various languages.

For instructions how to use this tool see USER GUIDE.

See also Code Examples Validator and implementation (.travis.yml) in the PlatformOfTrust/docs repository.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.


This is a Clojure project and requires:

  1. Java 8 or above
  2. Leiningen 2.0 or above (OSX users can use brew install leiningen).

You can make sure that everything is installed by running java --version && lein -v.

$ java --version && lein -v
java 11.0.2 2018-10-16 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.2+7-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.2+7-LTS, mixed mode)
Leiningen 2.9.1 on Java 11.0.2 Java HotSpot(TM) 64-Bit Server VM

Running the application

lein run will run the code example generator (and install dependencies). Without passing any extra parameters it will display command line help.

 $lein run
  -s, --source PATH                     Required RAML file or a directory that contains RAML files.
  -d, --dest PATH      ./pot-examples   Optional Directory for generated code examples.
  -H, --host HOST  Optional URI host.
  -S, --scheme SCHEME  https            Optional URI scheme (`https` or `http`).
  -h, --help
  -v, --version

See user guide for more details how to use it.


lein test                               # Run unit tests
lein test-refesh                        # Run unit tests automatically when files change
lein cloverage                          # Generate code coverage report

NB! This project is expected to have > 50% code coverage for unit tests and it has been set as a criteria for successful builds in CI. You can change it in project.clj.

  :cloverage {:fail-threshold 50
              :low-watermark 70
              :high-watermark 90}


Each commit to master branch will trigger a new build process that will build a binary (jar file raml2http.jar) that will be uploaded to the assets of latest release.

Each tag will create a release with tag name and upload jar file with version suffix e.g. raml2http-v1.0.1.jar.


You might want to...

lein eastwood                           # Linter
lein kibit                              # Static code analyzer
lein bikeshed                           # Gives tips for writing better code
lein ancient                            # Check for outdated dependencies
lein annotations                        # Display all comment annotations (TODO, FIXME etc.)


This project is licensed under the MIT License - see the LICENSE file for details.

Copyright © 2019 Platform Of Trust

You can’t perform that action at this time.