0

我正在用connexion编写一个 python 服务。我可以通过localhost:<port>/ui. 但是,当我在没有(由 connexion自动localhost:<port>添加)的情况下进入浏览器时,我收到以下消息:/ui

{
  "detail": "The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.",
  "status": 404,
  "title": "Not Found",
  "type": "about:blank"
}

是否可以自定义此消息?就我而言,我想localhost:<port>返回以下消息:

{"message": "check /ui to have access to the Swagger UI"}
4

1 回答 1

0

我想我找到了解决办法。只需将以下内容添加到 openspec api:

  /:
    get:
      operationId: path.to.function
      summary: "my personlized message"
      responses:
      ......
于 2020-10-01T12:18:47.817 回答