我可以使用 Docker 变量(或其他方式)在 Swagger UI 2.x 中启用请求持续时间吗?

Can I enable the request duration in Swagger UI 2.x with a Docker variable (or in alternative ways)?

我知道有不同的方法 enable the HTTP request duration in Swagger UI 3.x:

Swagger UI accepts configuration parameters in four locations.

From lowest to highest precedence:

  • The swagger-config.yaml in the project root directory, if it exists, is baked into the application
  • configuration object passed as an argument to Swagger UI (SwaggerUI({ ... }))
  • configuration document fetched from a specified configUrl
  • configuration items passed as key/value pairs in the URL query string

例如 Docker 变量:

DISPLAY_REQUEST_DURATION="true"

我有一些 API 坚持使用旧的 Swagger UI 2.x。

请求持续时间仅在 Swagger UI 3.0.18+ 中可用,在 v.2.x

中不可用