Circular references in external documents create an infinite recursion
还没有人认领这个 Issue。
评估
调研方向
使用提供的 Kiota Docker 命令和链接的 pet.json、pets2.json 文件重现递归,然后跟踪在解析引用期间外部文档如何加载到工作区中。将附加的 circular_ref.patch 与当前行为进行比较;当相互引用的外部文档能够在不发生无限递归的情况下完成解析,同时仍保留在预期的工作区中时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
Describe the bug
Open api documents that contain circular references create an infinite recursion because each external document is loaded into a new root workspace rather than the initial document loader workspace.
OpenApi File To Reproduce
In order to reproduce, you need two files that reference each other. I've put a circular reference in the schemas section of the below specs (this is not the exact problem I'm seeing with real documents, but it's close enough to reproduce). The references are hard coded to a mount directory because I'm using kiota as a driver, so you may need to update the paths if you run against a different location.
Expected behavior
I believe external documents should all be loaded into the same workspace for reference resolution.
Screenshots/Code Snippets
docker run --rm `
-v "${PWD}\output:/app/output" `
-v "${PWD}\specs:/app/specs" `
-u root `
mcr.microsoft.com/openapi/kiota generate --language csharp -n MyCode --openapi ./specs/pet.json --log-level trace
I have encountered the problem in open api documents from large enterprise software providers, so I've attached a patch file that contains my work around for an internal fork of the document loader libraries. Adding external documents to the root workspace created by the initial document load appears to resolve the problem, though I'm not sure if the external references are being resolved correctly.
This patch includes the changes I was required to make in order to resolve locally.
circular_ref.patch
- 主要语言
- C#
- 星标
- 1.6k
- 派生
- 286
- 平均合并
- 6 小时 38 分钟
- 30 天内合并 PR
- 35
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
microsoft/OpenAPI.NET 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
microsoft/OpenAPI.NET#2798 ·
-
microsoft/OpenAPI.NET#3056 · 1 条评论 · 1 个 reaction · 已指派 2 人 ·
-
type:breaking-change
难度 4/5 3-5 天 新手友好度 52/100
microsoft/OpenAPI.NET#3014 · 2 条评论 ·
-
help wanted
难度 5/5 一周以上 新手友好度 35/100
microsoft/OpenAPI.NET#2989 · 3 条评论 ·
-
help wanted type:feature
难度 3/5 1-2 天 新手友好度 55/100
microsoft/OpenAPI.NET#2967 · 18 条评论 · 1 个 reaction ·
查看 microsoft/OpenAPI.NET 的全部 Issue
相似的 Issue
-
:watch: Not Triaged dotnet-fsharp/svc
难度 1/5 1 小时以内 新手友好度 90/100
-
Client customer-reported needs-team-attention question Service Attention WebPubSub
难度 2/5 1-3 小时 新手友好度 76/100
Azure/azure-sdk-for-net#63292 · 3 条评论 · 1 个 reaction ·
-
Issue-Enhancement Needs-Triage
难度 1/5 1 小时以内 新手友好度 86/100
PowerShell/PowerShell#28061 · 2 个 reaction ·
-
dependencies needs-team-triage server-Azure.Mcp
难度 2/5 1-3 小时 新手友好度 72/100
-
aspnet-core/svc aspnetcore-signalr/subsvc doc-enhancement Pri2 SignalR
难度 1/5 1 小时以内 新手友好度 88/100
dotnet/AspNetCore.Docs#37729 ·