[Spring] REST API Documentation (Open API, Swagger)
Advanced REST API Features (1)
/ Swagger / Open API
REST API Documentation
- Your REST API consumners need to understand your REST API:
- Resources
- Actions
- Request/Response Structure(Constraints/Validations)
- Challenges:
- Accuracy : How do you ensure that your documentation is up to date and correct?
- Consistency : You might have 100s of REST API in an enterprise.
- How do you ensure consistency?
- Options:
- 1: Manually Maintain Documentaion
- Additional effort to keep it in sync with code
- 2: Generate from code
- 1: Manually Maintain Documentaion
REST API Documentation - Swagger and Open API
- Quick overview:
- 2011: Swagger specification and Swagger Tools were introduced
- 2016: Open API Specification created based on Swagger Spec.
- Swagger Tools (ex: Swagger UI) continue to exist
- Open API Specification: Standard, language-agnostic interface
- Discover and understand REST API
- Earlier called Swagger Specification
- Swagger UI: Visualize and interact with your REST API
springdoc-openapi
java library helps to automate the generation of API documentation for spring boot projects.
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>2.1.0</version>
</dependency>
https://springdoc.org/v2/ https://springdoc.org/#Introduction
댓글남기기