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

Unable to parse schema Errors

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

还没有人认领这个 Issue。

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

描述

Describe the bug
I'm attempting to convert a rather large open api schema to Pyhton bindings and am running across warnings that are dropping endpoints on the floor. I believe there is a couple of issues.

  1. Refs not supported: Do you know if there are plans to add support for references in request body? I'll look at ways to flatten this schema out without references and try this again
"requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/MetadataFieldGroupType"
                            }
                        },
                        "application/xml": {
                            "schema": {
                                "$ref": "#/components/schemas/MetadataFieldGroupType"
                            }
                        }
                    },
                    "required": true,
                    "description": ""
                }
WARNING` parsing PUT /collection within collection. Endpoint will not be generated.
Could not find reference in parsed models or enums

Reference(ref='#/components/schemas/ItemSearchType')
WARNING parsing POST /collection within collection. Endpoint will not be generated.

Could not find reference in parsed models or enums
Reference(ref='#/components/schemas/CollectionType')
  1. Parth parameters not match with path. I believe this may be due to the open "in path" vs "in query" issue.
WARNING parsing GET /collection/{collection-id}/item within collection. Endpoint will not be generated.

Incorrect path templating for /collection/{collection-id}/item (Path parameters do not match with path)
{
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "in": "path",
                        "name": "collection-id",
                        "description": "The collection id."
                    }
  1. Generic cannot parse parameter of endpoint getAccessGraphDot

cannot parse parameter of endpoint getAccessGraphDot

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=['ancestor', 'grant'], type=<DataType.STRING: 'string'>, allOf=[], 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)

To Reproduce
Steps to reproduce the behavior:

  1. Run openapi-python-client generate --path openapi/spec.json
  2. Run openapi-python-client generate --path openapi/spec.yaml

Expected behavior
A full python client should be generated without warnings.

OpenAPI Spec File
Standby. Making sure I have approval to share this schema since its coming from a 3rd party vendor.

Desktop (please complete the following information):

  • OS: macOS 12.4
  • Python Version: 3.8.9
  • openapi-python-client version: 0.11.4

贡献指南

打开贡献指南

从这里开始

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

调研方向

openapi-python-client generate --path openapi/spec.json.yaml 命令开始,检查有关请求体引用、路径参数和 getAccessGraphDot 的警告。vendor schema 未包含在内,因此在其可用后重新复现;当完整的 Python 客户端生成时没有警告或被丢弃的端点,即视为完成。

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

评估

技术栈
openapi, python
领域
api, devtools
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
25/100

把新 issue 发到你的邮箱

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