Swagger UI

Introduction

Swagger UI allows you to visualize and interact with your APIs without having any of the actual implementation logic in place. The APIs are automatically generated from your OpenAPI (formerly Swagger) Specification, with the visual documentation making it easier to later implement the back end code.

The OpenAPI Specification

Your OpenAPI Specification is a set of rules that symantically describes your API. It is written either in YAML or JSON, and so is both human and machine readable. The classic example one sees in tutorials is a simple YAML description of a Pet Store API:

Swagger File

If you look at the OpenAPI file closely, you’ll see it begins with identifing information on the API. The paths section is next, and you’ll find a description of a GET request which returns a list of up to 100 pets.

Swagger UI

Once your OpenAPI Specification is complete it can be used to generate a basic user interface. The user interface for Keep can be found here: http://localhost:8880/openapi/index.html, and it looks like this:

Swagger UI

References

Keep Swagger UI: http://localhost:8880/openapi/index.html

Swagger UI Homepage: https://swagger.io/tools/swagger-ui/

Pet Store UI: https://petstore.swagger.io/

Pet Store Yaml: https://github.com/OAI/OpenAPI-Specification/blob/master/examples/v2.0/yaml/petstore.yaml