API package:servant-openapi3

Generate a Swagger/OpenAPI/OAS 3.0 specification for your servant API. Swagger is a project used to describe and document RESTful APIs. The core of the project is the OpenAPI Specification (OAS). This library implements v3.0 of the spec. Unlike Servant it is language-agnostic and thus is quite popular among developers in different languages. It has also existed for a longer time and has more helpful tooling. This package provides means to generate a Swagger/OAS specification for a Servant API and also to partially test whether an API conforms with its specification. Generated Swagger specification then can be used for many things such as
This module provides means to generate and manipulate OpenApi specification for servant APIs. OpenApi is a project used to describe and document RESTful APIs. The OpenApi specification defines a set of files required to describe such an API. These files can then be used by the OpenApi-UI project to display the API and OpenApi-Codegen to generate clients in various languages. Additional utilities can also take advantage of the resulting files, such as testing tools. For more information see OpenApi documentation.
Generate a OpenApi specification for a servant API. To generate OpenApi specification, your data types need ToParamSchema and/or ToSchema instances. ToParamSchema is used for Capture, QueryParam and Header. ToSchema is used for ReqBody and response data types. You can easily derive those instances via Generic. For more information, refer to openapi3 documentation. Example:
newtype Username = Username String deriving (Generic, ToText)

instance ToParamSchema Username

data User = User
{ username :: Username
, fullname :: String
} deriving (Generic)

instance ToJSON User
instance ToSchema User

type MyAPI = QueryParam "username" Username :> Get '[JSON] User

myOpenApi :: OpenApi
myOpenApi = toOpenApi (Proxy :: Proxy MyAPI)
Generate a OpenApi specification for a servant API.
Methods, available for OpenApi.
Check whether sub is a sub API of api.