Skip to content

slamdev/openapi-spring-generator

Repository files navigation

openapi-spring-generator

OpenAPI Generator for Java Spring framework

Build Actions Status Gradle Plugin Portal

Motivation

In a microservice world you need to provide a communication layer between your services. Doesnt matter you go with sync (HTTP) or async (PubSub) way, you need to maintain a contract between two sides.

This plugin generates code for DTOs as well as interfaces\services for HTTP client\server and PubSub consumer\producer based on the OpenApi v2\v3 spec file.

Whenever the spec file is changed, generated code is changed as well, thus allowing you to catch and contract incompatibilities in the runtime.

Usage

First step is to add the plugin to your project as described here.

Next step is to write specification of you API in Swagger/OpenAPI yaml format. Swagger editor is really helpful for this task.

Make a release

TAG=x.x.x && git tag -a ${TAG} -m "make ${TAG} release" && git push --tags