Adding springdoc-openapi to the source code
To add OpenAPI-based documentation regarding the external API that's exposed by the product-composite-service
microservice, we need to change the source code in two projects:
product-composite-service
: Here, we will set up a configuration ofspringdoc-openapi
in the Java application class,ProductCompositeServiceApplication
, and add some general information pertaining to the API.api
: Here, we will add annotations to the Java interface,ProductCompositeService
, describing each RESTful service and its operations. At this stage, we only have one RESTful service with one operation, accepting HTTPGET
requests to/product-composite/{productId}
, which is used for requesting composite information regarding a specific product.
The actual texts that are used to describe the API operation will be placed in the default property file, application.yml
, in the product-composite-service
project.Before we can start using springdoc-openapi
, we need to...