OpenAPI is a specification for documenting your HTTP based API.
Example
openapi: 3.0.0
info:
title: My app API
version: 1.0.0
paths:
/users:
get:
summary: Retrieve a list of users
responses:
"200":
description: A list of users
content:
application/json:
schema:
type: array
items:
type: object
properties:
id:
type: integer
name:
type: string
It describes how both a request and a response should look like.
Usually YAML format is used, but there is also support for other formats (for example JSON).
How it relates to Swagger?
OpenAPI specification was originally developed within Swagger (as Swagger specification) and then forked as a separate project.