🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

raml2code

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

raml2code - npm Package Compare versions

Comparing version
1.8.2
to
1.8.3
+5
-2
History.md

@@ -1,6 +0,9 @@

1.8.0 / 2015-06-06
1.8.3 / 2015-03-18
==================
* Updating raml-js-parser to 0.8.10
1.8.0 / 2015-03-06
==================
* Making a refactor, separating generators to it's own module, updating reamde
0.8.41 / 2015-06-05
0.8.41 / 2015-03-05
==================

@@ -7,0 +10,0 @@ * Adding default values to retrofit arguments

{
"name": "raml2code",
"version": "1.8.2",
"version": "1.8.3",
"description": "Raml spec to code",

@@ -5,0 +5,0 @@ "main": "index.js",

+10
-94

@@ -5,19 +5,2 @@ # Raml to code generator

## Versioning
The raml2code generator is versioned in the following manner:
```
x.y.z
```
in which *x.y* denotes the version of the [RAML specification](http://raml.org/spec.html)
and *z* is the version of the raml2code.
So *0.8.38* is the 38nd revision of the ralm2code for the *0.8* version
of the [RAML specification](http://raml.org/spec.html).
* This module generate code from a RAML definition
* It uses Handlebars templates
## It's a Gulp-plugin so to try

@@ -31,2 +14,3 @@ 1. Install gulp

```bash
npm install --save-dev raml2code
npm install --save-dev raml2code-groovy-pojo

@@ -40,3 +24,3 @@ ```

//Install a generators:
var genDTO = require("raml2code-groovy-pojo");
var genDTO = require("raml2code-retrofit");

@@ -55,77 +39,2 @@ gulp.task("dtos", function(){

## Sample gulpfile.js
```js
var gulp = require('gulp');
var raml2code = require("raml2code");
var genPojos = require("raml2code-groovy-pojo");
var genJaxRS = require("raml2code-jaxrs-interfaces");
var genRetrofitClient = require("raml2code-retrofit");
var raml = require('gulp-raml');
var packagePojo = "gex.catapi.dto";
var packageClient = "gex.catapi.client";
var packageJersey = "gex.catapi.resources";
//this should point to your raml definition
var ramlResource = '../../test/raml/cats.raml'
gulp.task('raml', function() {
gulp.src(ramlResource)
.pipe(raml())
.pipe(raml.reporter('default'))
.pipe(raml.reporter('fail'));
});
gulp.task("genPojos", ['raml'], function(){
gulp.src(ramlResource)
.pipe(raml2code({generator: genPojos, extra: {package: packagePojo}}))
.pipe(gulp.dest('./src/generated/groovy/gex/catapi/dto'));
});
gulp.task("genRetrofitClient" , ['raml'], function(){
gulp.src(ramlResource)
.pipe(raml2code({generator: genRetrofitClient, extra: {package: packageClient, importPojos: packagePojo}}))
.pipe(gulp.dest('./src/generated/java/gex/catapi/client'));
});
gulp.task("genJaxRS" , ['raml'], function(){
gulp.src(ramlResource)
.pipe(raml2code({generator: genJaxRS, extra: {package: packageJersey, importPojos: packagePojo}}))
.pipe(gulp.dest('./src/generated/groovy/gex/catapi/resources'));
});
gulp.task('build', ['raml', 'genPojos', 'genJaxRS', 'genRetrofitClient']);
gulp.task('default', ['build']);
```
## A full example of using using raml2code could be found here:
[raml2code-Example](https://github.com/atomsfat/raml2code-example)
## We use the Gradle with the gulp plugin to build and integrate with Java.
[gradle](https://www.gradle.org/)
[gradle-gulp-plugin](https://github.com/filipblondeel/gradle-gulp-plugin)
## You can make your own generators, DIY
A generator is a simple object with the following properties:
* Required properties:
* template -> Handlebars template (you could use your own templates).
* parser(data) -> Function it receives RAML parsed data, returns model that will be used in the
template engine, each model must have a name, this name is the file that will be generated.
[{ name: "test.test", model: {title:data.title + " finos"}}]
* Optional properties:
* helpers -> Handlebars helpers.
* partials -> Handlebars partials.
## Generators create and in use by GEX.

@@ -139,6 +48,13 @@ * [raml2code-groovy-pojo](https://www.npmjs.com/package/raml2code-pojo)

## A full example of using using raml2code could be found here:
[raml2code-Example](https://github.com/atomsfat/raml2code-example)
## You can make your own generators, DIY
[Generator specification](https://github.com/gextech/data2code/blob/master/Generator.md)
### We use the Gradle with the gulp plugin to build and integrate with Java.
[gradle](https://www.gradle.org/)
[gradle-gulp-plugin](https://github.com/filipblondeel/gradle-gulp-plugin)