Circular references in external documents create an infinite recursion
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
Research direction
Reproduce the recursion with the linked pet.json and pets2.json files using the provided Kiota Docker command, then trace how external documents are loaded into workspaces during reference resolution. Compare the attached circular_ref.patch with the current behavior; done means mutually referencing external documents resolve without infinite recursion while remaining in the intended workspace.
Written by the indexing model from the issue text.
Description
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
- Dominant language
- C#
- Stars
- 1.6k
- Forks
- 286
- Avg merge
- 6h 38m
- Merged PRs (30d)
- 35
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/OpenAPI.NET
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
microsoft/OpenAPI.NET#2798 ·
-
microsoft/OpenAPI.NET#3056 · 1 comment · 1 reaction · 2 assignees ·
-
type:breaking-change
Difficulty 4/5 3-5 days Newbie friendliness 52/100
microsoft/OpenAPI.NET#3014 · 2 comments ·
-
help wanted
Difficulty 5/5 Over a week Newbie friendliness 35/100
microsoft/OpenAPI.NET#2989 · 3 comments ·
-
help wanted type:feature
Difficulty 3/5 1-2 days Newbie friendliness 55/100
microsoft/OpenAPI.NET#2967 · 18 comments · 1 reaction ·
All issues in microsoft/OpenAPI.NET
Similar issues
-
Status: Waiting triage Type: Bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
nanoframework/Home#1857 ·
-
kind/bug kind/regression
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
unoplatform/uno.toolkit.ui#1646 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
nightscout/nocturne#1379 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
elastic/esql-dotnet#47 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100