The purpose of this project is to demonstrate how you could create a Contract-First API for Vert.x using OpenAPI Generator and jOOQ
Great question! At first glance, it seems somewhat complicated doesn't it?!?! Once you get past that, it's really not so bad. Here's how it works:
- You start with an OpenAPI Specification file (the contract) HERE
- Using that contract, the
modules/data-access
module uses the OpenAPI Generator to create SQL DDL for the schema classes - The jOOQ Maven Plugin then generates the jOOQ code needed to wire our data types to the database using the Vert.x jOOQ custom generator.
- The DAOs created by the jOOQ generator are then used to implement our Service Classes in the
modules/api
module
The modules/converters
module is purely to allow for the creation/compilation of the jOOQ custom type converters, and if you are not using UUIDs as your primary key you shouldn't need to worry about it.
TL;DR - Ignore everything except the modules/api
module. Everything that we will be doing as developers will
happen in that module alone. Everything else is tooling/automation so that we get a bunch of stuff done for us for
free.
- Java JDK 17
- Docker (or Podman >=3.3 and docker socket configured)
- Docker Compose
mvn clean verify
docker-compose up -d
mvn clean install
mvn -pl modules/api clean compile vertx:run
Swagger UI has been integrated and is expose on port 8080 at the path /swagger/
. When
running locally, this would be http://localhost:8080/swagger/