slush-vertx is a project created by Paulo Lopes born to simplify build tools configurations for Vert.x. I totally refactored
slush-vertx to create a multi purpose code generator for simplify various configurations of Vert.x powered projects.
Multi purpose and simple to enlarge
When I designed the new slush-vertx, I tried to create a Vert.x project generator for every configuration needed, not only an OpenAPI 3 server or OpenAPI 3 client. Another important variable of my project is create a generator that generates code for different languages and different build tools.
slush-vertx It’s like a “code generation hub”: It contains a set of project generators, based on what type of Vert.x project are you going to scaffold. At the moment I’m writing this post, slush-vertx contains:
- Vert.x Starter project generator: Based on original Paulo’s project, generates an empty project configured for Vert.x 3 Framework
- Vert.x Web Server Starter generator: Generates a skeleton with sources and tests for Vert.x 3 Web powered REST server
- Vert.x Web Server OpenAPI project generator: Generates a skeleton based on Swagger 2/OpenAPI 3 specification with sources and tests for Vert.x 3 Web powered REST server
- Vert.x Web Client OpenAPI project generator: Generates a client based on a Swagger 2/OpenAPI 3 specification and Vert.x 3 Web Client
I hope it will grow in the future, creating a tool that can help people to connect with Vert.x world.
How it works
Behind the scenes
slush-vertx is metadata and template driven code generator. This means:
- For every language/build tool it has a set of metadata, that can be extended with user inputs
- It uses a template engine to generate code, based on metadata
If you want a complete scenario of behaviours of slush-vertx, give a look at this wiki page
But, why that complexity behind a code generator? I mean, It’s only a code generator! Yes, It’s only a code generator, but I wanted to create a tool simple to extend with new generators routines, giving to Eclipse Vert.x a powerful tool.
Generate unit tests
So, if you have a powerful build tool that generates pretty everything you want, why don’t take advantage of it doing things that you don’t want to do? And this is what I’ve done! Copy-pasting code from other generators I’ve created, I builded a unit test generator for
vertx-web-api-contract-openapi. This generator takes all operations declared in this oas 3 spec and generates a specific test to validate the correct parsing of parameters on server side. This is the final result:
OpenAPI3ParametersUnitTest.java. This unit tests helped me a lot to complete the
With some small changes this can be a complete server libraries/frameworks compatibility test tool for OpenAPI 3
Now use it! Follow the readme inside GitHub repository to install and start using it.