首页 > 解决方案 > 是否可以使用 apispec 跟踪内部/私人文档?

问题描述

我正在使用 Flask 服务器并正在考虑使用 apispec 对其进行记录。问题是一些函数有内部注释或私人信息,例如开发者电子邮件、TODO 注释等。

是否可以将这些与 apispec 的 yaml 一起干净地包含在函数文档字符串中?

下面是一个玩具示例:

@app.route("/api/user/forgot-password", methods=["POST"])
def forgot_password():
    """
    This API returns stuff.
    ---
    post:
      tags:
        - user
      parameters:
        - name: comments
          in: body
          description: >-
            Include comments.
          default: true
          required: false
          schema:
            type: boolean
      responses:
        '200':
          description: Null response
          content:
            application/json:
              schema:
                type: object
    """
    # Internal/original docstring
    """
    TODO: etc.

    Author: Author --<email@eyenuk.com>
    Created: 6/28/2018 4:53:29 PM

标签: swaggeropenapiflask-apispec

解决方案


推荐阅读