API Specifications and Implementation
In previous chapters, we learned about the design aspects of REST APIs and the Spring fundamentals required to develop RESTful web services. In this chapter, you’ll make use of these two areas to implement REST APIs.
We have chosen a design-first approach for implementation to make our development process understandable for non-technical stakeholders as well. To make this approach possible, we will make use of the OpenAPI Specification (OAS) to, first, design an API and, later, implement it. We will also learn how to handle errors that occur while serving the request. In this chapter, we will use the example of designing and implementing an API of a sample e-commerce app.
By the end of this chapter, you should be able to design the API specifications and make use of the OpenAPI codegen to generate the code for models and API Java interfaces. You will also know how to write the pseudo-Spring controllers to implement the API Java interfaces...