To get started with this project, you will need to have the following installed on your local machine:
-
JDK 11+
-
Maven 3+
Swagger: is a specification for defining APIs (Application Programming Interfaces)Originally, Swagger was a framework for API documentation and design, which included tools for generating interactive API docs, code generation, and more. The Swagger specification, now known as Swagger 2.0, was the standard for describing APIs before OpenAPI. OpenAPI Specification (OAS): The OpenAPI Specification is a more formal and standardized version of the Swagger specification. In 2016, the Swagger Specification was donated to the Linux Foundation and became part of the OpenAPI Initiative, which is now responsible for the specification's development and evolution. The OpenAPI Specification (currently at version 3.x) represents a significant advancement over Swagger 2.0. OpenAPI 3: This is the 3rd version of the OpenAPI Specification and offers more advanced features and improvements over Swagger 2.0. It provides a more powerful and flexible way to describe APIs, including better support for component reusability, enhanced security definitions, and more detailed specification of request and response formats.
-
Features
API Documentation: Swagger/OpenAPI provides a structured and standardized way to document APIs. It allows developers to define endpoints, request/response formats, authentication methods, error handling, parameters, and It uses a JSON or YAML to describe the API and its docs. This documentation can be automatically generated and made thus allows multiple developers or teams to collaborate on API development making it easier to understand and consume the API. Client SDK Generation: Swagger specifications can be used to generate client SDKs for various programming languages. These SDKs provide pre-built code and functions that make it easier for developers to interact with the API. authentication, and error handling. Testing: Swagger/OpenAPI can be leveraged to generate automated tests for the API. By defining request/response examples and expected behavior in the specification, developers can generate test cases that validate the API's functionality and performance. Automated testing helps catch issues early in the development process and ensures the API behaves as expected. API Visualization: Swagger specifications can be used to generate interactive API documentation using tools like Swagger UI.
Java-11+
Spring-boot
Open-API3(Swagger)
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>1.8.0</version>
</dependency>
or
implementation 'org.springdoc:springdoc-openapi-ui:1.8.0'
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>2.6.0</version>
</dependency>
or
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.6.0'
- Locally
- Clone the repository:
git clone https://github.com/vikrantgit97/OpenApi-Documentation.git
- Navigate to the project directory
- Build the project:
mvn clean install
- Run
mvn clean package spring-boot:run
to build the artifact and run the application
- Clone the repository:
SwaggerDocumentation_SpringBoot_Application to visualize the exposed API
- Swagger UI:
http://server:port/swagger-ui.html
- OpenAPI
http://server:port/v3/api-docs
2)Setting Up Swagger 2 with a Spring REST API Using Springfox
3)Spring Boot REST API Documentation with Swagger
4)API Documentation using Swagger 3 with Spring Boot 2 + Spring Security
5)Spring Boot and Swagger — Writing Good API Documentations
6)https://spring.io/projects/spring-restdocs (by Spring official)
8)Swagger
9)Spring Boot + Swagger 3 example (with OpenAPI 3)
Install any LINUX OS or Ubuntu for Development Recommended. (https://releases.ubuntu.com)