openapi-generators / openapi-generators/openapi-python-client
Unable to parse schema definition with anyOf/allOf within one another
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 2k
- 派生
- 293
- 平均合并
- 34 分钟
- 30 天内合并 PR
- 1
描述
Describe the bug
Schema definition in components of combined schemas are failing to be parsed, with the following error:
Unable to parse this part of your OpenAPI document: : Invalid property in union /components/schemas/composite_object
Schema(title=None, multipleOf=None, maximum=None, exclusiveMaximum=None, minimum=None, exclusiveMinimum=None, maxLength=None, minLength=None, pattern=None, maxItems=None, minItems=None, uniqueItems=None, maxProperties=None, minProperties=None, required=None, enum=None, type=None, allOf=[Reference(ref='#/components/schemas/simple_object1'), Reference(ref='#/components/schemas/simple_object2')], oneOf=[], anyOf=[], schema_not=None, items=None, properties=None, additionalProperties=None, description=None, schema_format=None, default=None, nullable=False, discriminator=None, readOnly=None, writeOnly=None, xml=None, externalDocs=None, example=None, deprecated=None)
Surprisingly, combined schemas are correctly parsed when defined in paths : this is the uncommented part in the gist.
OpenAPI Spec File
A link to an OpenAPI document which produces this issue. Ideally, write a minimal reproduction only containing the problematic pieces.
Desktop (please complete the following information):
- OS: Amazon Linux 2
- Python Version: 3.11.5
- openapi-python-client version 0.15.2
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
使用链接的 OpenAPI gist 重现该失败,重点关注会嵌套 anyOf/allOf 的 components 中的 schema,然后将该路径与 paths 下正常工作的 schema 处理进行比较。跟踪两种情况下的 parser 入口点;完成标准是 component schema 能够解析,并且客户端生成成功且不出现 invalid-property 错误。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- openapi, python
- 领域
- api, tooling
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100