Spring Boot 3 + Swagger (OpenAPI) Hello World Example
Video
This tutorial is explained in the below Youtube Video.What is OpenAPI Specification and the need for it
Modern applications are developed as microservices. APIs in microservices refer to the Application Programming Interfaces that allow different microservices to communicate with each other. APIs act as the interface between these microservices, enabling them to interact and share data or functionality. These API's using which microservices communicate with each other can be of any type RESTful API, GraphQL API, gRPC API. For example for Spring Boot 3 + MySQL + CRUD example we have exposed REST API's to perform CRUD operations.In microservices architecture we have may have hundreds/thousands of applications that interact with each other using API's.
Now consider the scenario where we are developing an some APIs for a microservice. We need to share these details with the client developer team and the QA team who will be consuming this API's. So that these teams can also begin their work simultaneously. So we need to share the API documentation with the client developer and QA team. If the API developers do this documentation manually they may miss some details which may cause issues. This is where OpenAPI specification comes into picture.
So OpenAPI specification is needed for
- Proper API Documentation - Missing details in API documentation might lead to developers spending more time to understand code, perform more analysis and tests. This leads to more time consumed.
- Team Collaboration -API developement may need collaboration between various stakeholders like developers, clients, QA team, business analysts. Define the request and response parameters.
- Standard Documentation - OpenAPI is a standard which is followed by all organizations. So each organization will not have the need to develop by each organization seperately.