swaggerui

您可以在使用 swagger 布局 swagger layout 的页面任意位置插入 swaggerui 短代码。该短代码能够以任何 OpenAPI YAML 或 JSON 文件为数据源,渲染出 Swagger UI 界面。该源文件可存放于任意可访问的位置,例如您站点的根目录 /static 静态文件夹中。

+++
title = "Pet Store API"
type = "swagger"
weight = 1
description = "Reference for the Pet Store API"
+++

{{< swaggerui src="/openapi/petstore.yaml" >}}
---
title: "Pet Store API"
type: swagger
weight: 1
description: Reference for the Pet Store API
---

{{< swaggerui src="/openapi/petstore.yaml" >}}
{
  "title": "Pet Store API",
  "type": "swagger",
  "weight": 1,
  "description": "Reference for the Pet Store API"
}

{{< swaggerui src="/openapi/petstore.yaml" >}}

You can customize Swagger UI’s look and feel by overriding Swagger’s CSS in themes/docsy/assets/scss/_swagger.scss.