MicroProfile OpenAPI - code first or design first?
You're given the task of writing a microservice AND providing a documentation in OpenAPI format. You already know that there are two main approaches:
- design-first : write the OpenAPI document (a.k.a. the
openapi.yaml
file) and then generate the code - code-first : write the code, using OpenAPI annotations, and then generate the OpenAPI document
Which approach do you choose?
I'll compare the two approaches by showing a simple Java microservice implemented twice, once design-first and once code-first.
Experience level:
Intermediate