openapi-processor-micronaut

badge License Apache%202.0 blue openapi processor micronaut?label=Maven%20Central

openapi-processor-micronaut is an OpenAPI interface & model java code generator for Micronaut.

It supports an approach where you explicitly define and document your Service API (using OpenAPI) with the Interface to the outside and its usage in mind before you implement it. You do not derive the API later from the implementation and its implicit design. (of course, adapt as you go…​)

The advantages are:

  • you have a single place to maintain the api which makes it easier to create a consistent api and keep the overview.

  • it is easy to document in plain text. You can use markdown in the OpenAPI description properties.

The processor generates java interfaces based on the endpoint description of the API and simple POJO classes for parameter or response objects defined in the API. The processor adds all the required micronaut & jackson annotations to the interface and all that is left to you is the implementation of the generated interfaces in any way you like.

The interfaces will help to keep the implementation in sync with the API. If anything relevant changes in the API the interface changes and the compiler will warn that the interface is not implemented correctly.

The target programming language is Java so the generated code is usable from most JVM languages.

documentation

openapi-processor-micronaut doesn’t have micronaut specific documentation so far. Follow the openapi-processor-spring documentation. Most of it is valid for the micronaut processor. Just replace the Spring Boot annotations with the Micronaut annotations.