Interest in taking Schema description from Schema.__doc__ docstring

未关闭
#861 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
35/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
技术栈
openapi, python
领域
api, documentation

调研方向

从 src/apispec/ext/marshmallow/openapi.py 中现有的 Meta.description 处理附近开始。检查 schema 描述是如何生成的,以及所引用的 flask-smorest 格式是否适用;完成标准是:当 Meta.description 不存在时,Schema.doc 可以提供描述,同时不会替换显式指定的 Meta.description。

由索引模型根据 Issue 内容生成。

描述

You take the object description from Meta.description in https://github.com/marshmallow-code/apispec/blob/8cbbbeb1630ff4d5732f2287b4985df84681af47/src/apispec/ext/marshmallow/openapi.py#L260

Do you have interest in a pull request to also get it from the Schema docstring? Something like:

if hasattr(Meta, "description"):
    jsonschema["description"] = Meta.description
elif schema.__doc__:
    jsonschema["description"] = schema.__doc__

You can do the same formating as in https://flask-smorest.readthedocs.io/en/latest/openapi.html#add-summary-and-description.

Makes sense?

主要语言
Python
星标
1.2k
派生
210
平均合并
2 天 1 小时
30 天内合并 PR
4

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

marshmallow-code/apispec 的其他 Issue

查看 marshmallow-code/apispec 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。