What is OpenAPI?
OpenAPI (formerly known as Swagger) is a specification for describing RESTful APIs. It is written in YAML Ain’t Markup Language (YAML) or JavaScript Object Notation (JSON), both structured and machine-readable formats, but simultaneously human-readable. This way, your API can be documented so that humans and machines can understand without needing the source code. Also, OpenAPI is language agnostic. It is not tied to Go or any other language, which makes it great for interoperability between different systems.
An OpenAPI document describes an API, its endpoints, operations, input/output (I/O) parameters, authentication methods, and other details. Let’s see a simple example of it:
openapi: 3.0.0
info:
title: Sample API
description: A sample API to illustrate OpenAPI concepts
version: 1.0.0
paths:
/users:
get:
summary: Returns a list of users
responses:
'200':
description...