
Security News
Socket Releases Free Certified Patches for Nuxt Security Vulnerabilities
Socket releases free Certified Patches for high-severity Nuxt vulnerabilities, including server-side remote code execution through server island props.
The raml2code generator is versioned in the following manner:
x.y.z
in which x.y denotes the version of the RAML specification 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.
var gulp = require('gulp');
var raml2code = require('raml2code');
var genDTO = require("raml2code/lib/generators/groovy/raml2DTO.js");
gulp.task("test", function(){
gulp.src('./test/cats.raml')
.pipe(raml2code({generator: genDTO, extra: {package:'com.gex'}}))
.pipe(gulp.dest('build'));
});
var gulp = require('gulp');
var raml2code = require("raml2code");
var genPojos = require("raml2code/lib/generators/groovy/pojo");
var genJaxRS = require("raml2code/lib/generators/groovy/jaxrsInterface");
var genRetrofitClient = require("raml2code/lib/generators/groovy/retrofitClient");
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 generator is a simple object with the following properties:
Groovy POJO This generator use json-schema spec heavily, when using $ref certain rules apply:
More info on $ref definitions, http://json-schema.org/latest/json-schema-core.html#anchor30
JAX-RS Interface We use the optional resource.displayName to name resource classes, if you use this generator don't forget to provide it. Example:
/cats:
displayName: Gatitos
Will generate GatitosResource
RETROFIT Client java interface
raml-client-generator javascript client generator from mulesoft raml-client-generator
FAQs
Raml spec to code
The npm package raml2code receives a total of 52 weekly downloads. As such, raml2code popularity was classified as not popular.
We found that raml2code demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket releases free Certified Patches for high-severity Nuxt vulnerabilities, including server-side remote code execution through server island props.

Security News
An open letter signed by 50 companies, from NVIDIA and Microsoft to Mistral and Hugging Face, urges Washington not to restrict open weight AI.

Security News
/Research
A fake corepack.org site is impersonating the Node.js tool and delivers an infostealer and proxyware to developers who download it.