Skip to content

Commit

Permalink
Add raml-to-html example
Browse files Browse the repository at this point in the history
  • Loading branch information
pkainulainen committed Dec 12, 2015
1 parent 7c754d1 commit b3ff0ae
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 0 deletions.
32 changes: 32 additions & 0 deletions raml-to-html/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
This is the example application of my blog post:

* [Generating HTML Documentation From RAML Documents With Maven]() - Not published yet

Prerequisites
=============

You need to install the following tools if you want to run this application:

Java Tools
---------

* [JDK 8](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html)
* [Maven](http://maven.apache.org/) (this application is tested with Maven 3.3.3)

Other Tools
----------

* [Node.js](http://nodejs.org/)
* [NPM](https://www.npmjs.com/)
* [raml2html](https://github.com/raml2html/raml2html)

Don't know how to install these tools? [Read my blog post]().

Creating the HTML API Documentation
===================================

You can create the HTML API documentation by running the following command at the command prompt:

mvn clean package

This creates the _api.html_ file to the _target_ directory.
37 changes: 37 additions & 0 deletions raml-to-html/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>net.petrikainulainen.maven</groupId>
<artifactId>raml-to-html</artifactId>
<version>0.0.1</version>
<packaging>jar</packaging>

<name>RAML To HTML</name>
<description>
This example demonstrates how you can generate HTML documentation from RAML documents with Maven.
</description>

<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.4.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>raml2html</executable>
<commandlineArgs>-i src/docs/api.raml -o target/api.html</commandlineArgs>
</configuration>
</plugin>
</plugins>
</build>
</project>
25 changes: 25 additions & 0 deletions raml-to-html/src/docs/api.raml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#%RAML 0.8
title: Example API
version: v1
baseUri: http://localhost:8080
protocols: [HTTP]
/api/todo:
get:
description: Finds the information of todo entries whose title or description contains the given searchTerm.
queryParameters:
searchTerm:
description: The used search term.
type: string
required: true
example: RAML
responses:
200:
description: Search was completed successfully.
body:
application/json:
example: |
{
"id": 1,
"title": "Write RAML blog post",
"description": "Write a blog post that describes how you can convert RAML documents into HTML."
}

0 comments on commit b3ff0ae

Please sign in to comment.