openapi-generators / openapi-generators/openapi-python-client

overriding model property with more specific object type doesn't work

未关闭
#1,123 1 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
Python
星标
2k
派生
293
平均合并
34 分钟
30 天内合并 PR
1

描述

Describe the bug
When an object schema derives from another object schema using allOf, and redeclares a property that had an object type to use a different object type, the generated code uses the old type for that property.

OpenAPI Spec File
https://gist.github.com/eli-bl/d5658d6714e1c9ef544ef1fc8902960a

With this example, the type of SpecialTask.result in the generated code should be SpecialTaskOutputData. Instead it is being declared as BaseTaskResult, the same as BaseTask.result.

Desktop (please complete the following information):

  • OS: macOS 14.5
  • Python Version: 3.8.15
  • openapi-python-client version: 0.21.5

贡献指南

打开贡献指南

从这里开始

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

调研方向

首先使用报告中链接的 OpenAPI 规范重现该问题,并检查为 BaseTask 和 SpecialTask 生成的模型。跟踪继承的和重新声明的对象属性如何被解析;当 SpecialTask.result 使用 SpecialTaskOutputData 类型而不是 BaseTaskResult 生成时,即表示完成。

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

评估

技术栈
openapi, python
领域
api, tooling
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

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