openapi-generators / openapi-generators/openapi-python-client
$ref in path parameters doesn't seem to work
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 2k
- 派生
- 293
- 平均合并
- 34 分钟
- 30 天内合并 PR
- 1
描述
Describe the bug
If a get path has a parameter using $ref to point to #/components/parameters, the generated API lacks the corresponding kwarg. If one "hoists" the indirect parameter up into the path's parameters, it works as expected.
To Reproduce
See this repo for a reproducible example.
And see this repo for the same schema without the $ref, working as expected.
Expected behavior
I expect to see the optional page kwarg in both generated APIs.
I see this in the $ref example:
def sync(
*,
client: Client,
) -> Optional[List[str]]:
and this in the noref example:
def sync(
*,
client: Client,
page: Union[Unset, None, GetTestPage] = UNSET,
) -> Optional[List[str]]:
OpenAPI Spec File
A link to your openapi.json which produces this issue.
Desktop (please complete the following information):
- OS: Microsoft Windows 10 Pro 10.0.19044 Build 19044
- Python Version: 3.9.12
- openapi-python-client version 0.11.1
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从可复现的 openapi-ref-issue 仓库中链接的 test-schema.yaml 开始,并使用报告的 openapi-python-client 版本运行生成器。将生成的 sync 入口点与 noref 示例进行比较,重点关注参数 $ref 的解析。当生成的 API 在引用参数的情况下也包含可选的 page kwarg 时,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- openapi, python
- 领域
- api
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 48/100