openapi-generators / openapi-generators/openapi-python-client
The `deprecated` field from OpenAPI operations is parsed but not exposed to templates
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 2k
- 派生
- 293
- 平均合并
- 34 分钟
- 30 天内合并 PR
- 1
描述
Describe the bug
The deprecated field on OpenAPI operation objects is parsed into the Operation schema model (operation.py#L31), but it is never carried over to the Endpoint dataclass that is passed to Jinja templates (openapi.py#L132-L152).
This means there is no way to check endpoint.deprecated in a custom template to conditionally emit deprecation warnings, docstring annotations, or @deprecated decorators.
The Endpoint dataclass is missing a deprecated: bool field, and the constructor at openapi.py#L419-L427 does not pass data.deprecated through.
Expected behavior
The Endpoint dataclass should include a deprecated: bool = False field, populated from data.deprecated during construction, so that templates can use {% if endpoint.deprecated %} to customize output for deprecated operations.
OpenAPI Spec File
Any spec with a deprecated operation, for example:
paths:
/example:
get:
operationId: getExample
deprecated: true
responses:
'200':
description: OK
Desktop (please complete the following information):
- OS: macOS 26.3
- Python Version: 3.9.6
- openapi-python-client version: 0.28.2
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 openapi_python_client/schema/openapi_schema_pydantic/operation.py 中的 Operation 模型,以及 openapi_python_client/parser/openapi.py 中的 Endpoint 数据类和构造函数开始。跟踪 operation 数据如何到达传递给 Jinja 模板的 Endpoint,然后验证 deprecated operation 会公开 endpoint.deprecated,并且在未指定时默认为 false。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- tooling
- Issue 类型
- 缺陷
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 活跃度
- 停滞
- 描述清晰度
- 描述清楚
- 新手友好度
- 58/100