raml2code Gulp plugin


Hi we have created a project to generate code from a RAML definition. For now it can generated POJO, Retrofit Client and JAX-RS Interfaces.



We integrate this gulp plugin as Gradle task , an example of the use of this plugin is here:


Also we are building a lazybones template just more test and we are going to publish.

Any ideas or suggestion we bill appreciated.


I’ll make sure to make a noise around this so you can get feedback! What is this generating? Server or Client code?


Both of them, the easy way to try on its https://github.com/atomsfat/raml2codeFullSpringExample


Also try out APIMATIC (https://apimatic.io)


I had released the version 0.8.40 fix some bug when generating POGO(Plain Old Groovy Objects). Also now it is posible to generarte POGO using just json-schema definitions (https://github.com/gextech/json-schema-2-groovy-pojo).

Also we have a lazy-bone templates in case you want to test or raml2code with spring-boot


So I am curious… for each language we want to support, such as groovy, .net, python, ruby and java, do we need to use separate language specific libraries to create objects from json schema (or xsd)? Ideally the dream goal is to use RAML to generate the POJO (java in this case) that is used in both client side SDK and server side code (JAX-RS is my personal favorite flavor).

Also, is there any way this could be put with the existing mulesoft code generator? For that matter, why is this not part of that in the first place? I am not trying to be a jerk…just wondering why this is a separate project with a very similar result?

I’d really like to see mulesoft and others push the client side SDK generators for different languages. Let’s make a big stink around this right now, maybe an IRC chat channel, along with the new forum topics… and get this in full swing. Anyone reading this, if you are a .net expert, or a ruby or python export, or perhaps Go or Java… please respond in the appropriate forums and lets all start contributing so that we can get multiple languages supported for both SDKs and possibly server side code generation.


No, just only need raml2code it had all the generators as dependencies inside.

The main issue to integrate or generator https://github.com/mulesoft/raml-client-generator is that raml2code doesn’t adhere to the implementation guide of https://github.com/mulesoft/raml-client-generator (the retrofit client), and it can generate POJO, JAX-RS interfaces (Server Side), Retrofit client, JS client.

I wanted that an active code generator so we made this a gulp plugin and integrate it with our build system(Gradle). raml2code is basically a gulp plugin that wrappers generators, indeed in our last release it uses https://github.com/mulesoft/raml-client-generator and know it can generates a JS client (Integrated as dependency).


I also like to add that it would be great if both projects could work together to create something awesome :blush: I will create a gitter channel and push the channel to the github repository so we can easier talk about that topic.


Done: https://gitter.im/mulesoft/raml-client-generator - please use this channel for questions and information only. There will be a trello board to discuss anything more in detail. We use different channel to really organise and bring the SDK generating tool forward with trello and at the same time to give people the possibility to “live” chat with people from the team.


@atomswork it would be great besides what @christian_vogel proposes that you might give us some info as to what it provides that the raml-client-generator does not? I will say I like the name better… raml2code makes more sense as it can be used to build bindings for client, server, etc. Possibly raml2anything or raml2<?> :smiley:

I would like to know which project to work from though, and it seems that the raml2code is a bit further along with a JAX-RS and POJO generator. I’d like to see some more tutorials possibly around it if possible? For example, I’d like to see how I could use it to generate java SDK, python SDK, etc. But most importantly, as @christian_vogel suggests we should avoid 2 similar but separate projects. Find a way to combine them in to one similar to the JAX-RS projects were merged.

Also… it would very beneficial to compare the current RAML to JAX-RS and your generator that appears to do the same thing. I say this because one is done in java, and one is done with a template engine. Ideally if we could get daily posts/chats going around this, that would be fantastic as myself and I am sure others have timelines to get things to market and we’re betting the farm on RAML. I am working on a RAML to SDK generator in Java using JavaPoet right now, and I’d hate to duplicate (or rather rewrite/reinvent) code if this template system is completely possible to use for all the different languages/options. The main problem is, the use of node/handlebars.js vs java… at least for me. I don’t know that I can spend a couple months trying to learn all the nuances around JS, Handlebars.js, coffee script, node, etc… and that may not account for the time needed to write the generators as well. Hence why I am asking for more participation more frequently, tutorials, blogs, etc. I know it requires time from those involved, but it would go a long way in pushing RAML to the forefront for use with developing APIs. It would also possibly put it in line with Swagger with regards to tooling, generators, etc. I feel we need to see a lot more activity on this generator topic… if this is the way to go, let’s get moving on combining/merging the projects, and lets get tutorials in place!


Agree with @justjacksonn. We need to sit together and talk about how we can merge the two existing projects into one. What do you think @atomswork? When we decided on how we proceed - @blakeembrey, @atomswork, and myself can concentrate on writing some tutorial around handlebars.js as I think that is the way to go.

What does everyone else think?


Sounds good… only pain point for me is I have to demo my SDK generation in 3 weeks… and I really wanted to go this route. I doubt I can learn enough Handlebars.js and JavaScript to get the current client generator or the raml2code project to spit out a working Java SDK… or could I? :wink: Basically I need to show a demo that can get buy in… then I can retrofit with the updated combined project as needed.

I just want to be clear again… sorry if this is a redundant question…but can the “combined” project generate SDKs (and even server side code, test code, etc) in ANY language? Our goal is Java first, then .NET (C#?), then ruby, python, and Go. I don’t know any of those other than Java and a bit of python. But I am still not sure we can rely on this process to produce all the language SDKs entirely… or will we need to use some native language constructs for things like pojo generation or something else?


Hi, guys please before you start coding please give a try to raml2code, and see how it works we had already 4 projects using it. By the end of the month it’s going to have a IOS client generator.

I thing that the following steps should be taken:

  1. Review and test raml2code(Try to generate code)
  2. Try to write a simple generator, handlebars it’s not to difficult to learn.
  3. I am finishing a refactor on ram2code to make easy to integrate new generators
  4. I have doubts if raml2code should have CLI
  5. Also if you review our github we have some issues that need fix https://github.com/gextech/raml2code/issues
  6. The java client is going to be integrate with https://github.com/mulesoft/raml-client-generator in a basic way, maybe it’s posible to respect the implementation guide but more work it’s needed.
  7. I’m thinking to create a web application, in order to engage people to try.


I am in the gitter chat now… asked there a few things… in particular, some updated README info on how to set up gradle, gradle-plugin, and more info on actually building/running it. I just ran the gulp in that directory, but I don’t see any build java source files or anything else. Sorry, still a noob with node/gradle and any info you can provide int he README for others that don’t know how to use it would go a long way in getting more people to try it. As it is now I can’t do anything other than git clone your repo.


I have made a new raml2code now each generator lives in his own module, better documentation and also a small example project has ben done raml2code-example


@atomswork I am still finding your project more difficult to work with to be honest. I would still think rather than reinventing the wheel, working with the Mulesoft team on their raml-generator project and providing SDK generators would be far more beneficial than a 2nd project that is similar, but yet different. Something led by Mulesoft that others contribute to would benefit everyone in the end. Not trying to say you would not support it, or walk away from it, but having 2 or more projects that do similar things sends the wrong message to those that might support the effort but are now unsure which one to use, as I was.

Being that you also use handlebars.js, and the raml-client-generator does as well, what does your project add or make better than what the raml-client-generator already did? I don’t see a clear distinction that your project provides a big improvement, or is any more (or less) convenient than what is already provided by Mulesoft.

I believe if you would work your JAX-RS and Java POJO generators into their project, it would benefit everyone and we could all start seeing more contributions for additional SDKs, documentation, server side, etc.