Swagger-UI with Spring Boot

Swagger-UI and Open API Specification with Spring Boot

What is Swagger

1. Simplify API development for users, teams, and enterprises with the Swagger open source and professional toolset.
2. Swagger is a set of tools that help you to create and use API definitions, including the ability to automatically generate documentation for APIs

1. API Definition file: Describes all the things you can do with an API, which automatically create documentation, Build SDK in various languages and Test
2. It contains, What requests are available, What the response looks like for each request.
3. Why Creating and API Definition?
        1. Lets you design API before implementing it.
        2. Helps with automated testing.
        3. Automatically create code in several languages.
        4. Can be used to automatically generate documentation
4. Historically, Swagger was a specification for how to create an API definition file.
5. After a new version (Swagger 2.0), the specification became the Open API Specification (OAS)
6. Swagger is no longer just an API specification, it's now a collection of tools that use the OAS.

Why Swagger

1. API Design: Design is the foundation of your API development. Swagger makes API design a breeze, with easy-to-use tools for developers, architects, and product owners.
2. API Development: Protocols, error handling, and code modularity are just some of the questions your teams need to address before building a great API. Swagger provides tools for quickly prototyping and building your API's functionality.
3. API Documentation: Swagger takes the manual work out of API documentation, with a range of solutions for generating, visualizing, and maintaining API docs.
4. API Testing: Start your functional, security, and performance testing right from the Open API Spec. Swagger tooling and the ReadyAPI platform make it easy to rapidly create, manage, and execute API tests in your pipeline.
5. API Mocking and Virtualization: Reduce dependencies in your development and testing cycles and stat realistic, dynamic mocks in seconds with Swagger and ServiceV Pro.
6. API Governance (and Standardization): People and processes make up a successful API program. Efficiently managing these efforts makes for good governance. Whether you have a team of five or five hundred, Swagger can help.
7. API Monitoring: Monitoring API availability, speed, and functionality starting from your OpenAPI Specification (OAS) with AlertSite for OAS. Automate monitor creation and instantly track API behavior to ensure everything runs smoothly in production.
8. OpenAPI & Swagger: Swagger offers the easiest to use tools to take full advantage of all the capabilities of the OpenAPI Specification (OAS).

AlertSite: For DevOps and Ops teams to validate and optimize private and public API performance. AlertSite makes it easy to create monitors & start monitoring from all over the world & in your private networks. You can reuse OAS files, paste, and API Endpoint, or use the Swagger Inspector extension to start monitoring.


OAS - Open API Specification

What is the OpenAPI Specification?

The OpenAPI Specification, formerly known as the Swagger Specification, is the world’s standard for defining RESTful interfaces. The OAS enables developers to design a technology-agnostic API interface that forms the basis of their API development and consumption.

The OpenAPI Specification was donated to the Linux Foundation under the OpenAPI Initiative in 2015. The specification creates a RESTful interface for easily developing and consuming an API by effectively mapping all the resources and operations associated with it.
OAS 2.0 https://swagger.io/specification/v2/
OAS 3.0 https://swagger.io/specification/

Swagger Tools

1. SwaggerHub: The design and documentation platform for teams and individuals working with the OpenAPI Specifications.

2. Swagger Inspector: Easily test and try out APIs right from your browser, and generate OPENAPI Specifications in seconds.

3. Swagger Codegen: Generate server stubs and client SDKs from OpenAPI Specification definitions.

4. Swagger Editor: API editor for designing APIs with the OpenAPI Specification.

5. Swagger UI : Visualize OpenAPI Specification definition in an interactive UI.

Steps

1. Create Spring boot project

2. Add Swagger dependancies to pom.xml


3. Add Config


4.  Enable Swagger


5. Add documentation

Load URL: http://localhost:8081/swagger-ui.html


Comments

Popular Posts