Title: Circular references in external documents create an infinite recursion · Issue #1985 · microsoft/OpenAPI.NET · GitHub
Open Graph Title: Circular references in external documents create an infinite recursion · Issue #1985 · microsoft/OpenAPI.NET
X Title: Circular references in external documents create an infinite recursion · Issue #1985 · microsoft/OpenAPI.NET
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 Repro...
Open Graph 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...
X 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...
Opengraph URL: https://github.com/microsoft/OpenAPI.NET/issues/1985
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Circular references in external documents create an infinite recursion","articleBody":"**Describe the bug**\nOpen 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.\n\n**OpenApi File To Reproduce**\nIn 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.\n\n[pet.json](https://github.com/user-attachments/files/18114824/pet.json)\n[pets2.json](https://github.com/user-attachments/files/18114826/pets2.json)\n\n**Expected behavior**\nI believe external documents should all be loaded into the same workspace for reference resolution.\n\n**Screenshots/Code Snippets**\n```pwsh\ndocker run --rm `\n -v \"${PWD}\\output:/app/output\" `\n -v \"${PWD}\\specs:/app/specs\" `\n -u root `\n mcr.microsoft.com/openapi/kiota generate --language csharp -n MyCode --openapi ./specs/pet.json --log-level trace\n\n```\n\n 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.\n\nThis patch includes the changes I was required to make in order to resolve locally.\n[circular_ref.patch](https://github.com/user-attachments/files/18114863/circular_ref.patch)\n\n","author":{"url":"https://github.com/rfsmart-anelson","@type":"Person","name":"rfsmart-anelson"},"datePublished":"2024-12-12T17:27:45.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/1985/OpenAPI.NET/issues/1985"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:03c35603-a12f-42c9-0099-3ea215391b5c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A256:3EDC68:DAD44C:11F5C4C:69818EFB |
| html-safe-nonce | a3f5296c92777ffdf9905d133ad2f714fe8f27474ddbfbc0e125a74591458ae1 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMjU2OjNFREM2ODpEQUQ0NEM6MTFGNUM0Qzo2OTgxOEVGQiIsInZpc2l0b3JfaWQiOiIzNTE3NjU0MTc3OTg1Njk1NDgzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | f6905309b6afa6e4b1dd5f56b0c87af4716270634b544a89befc1c40698aeafc |
| hovercard-subject-tag | issue:2736498374 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/OpenAPI.NET/1985/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e9ed8aa91ef43e1507019db4fbd53206e39d0374220d56c648c61ca3cf3f3e32/microsoft/OpenAPI.NET/issues/1985 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e9ed8aa91ef43e1507019db4fbd53206e39d0374220d56c648c61ca3cf3f3e32/microsoft/OpenAPI.NET/issues/1985 |
| og:image:alt | 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... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | rfsmart-anelson |
| hostname | github.com |
| expected-hostname | github.com |
| None | e137814e266030874fd2c86863529d0622b13889eeda04148c57654b6ea84ad6 |
| turbo-cache-control | no-preview |
| go-import | github.com/microsoft/OpenAPI.NET git https://github.com/microsoft/OpenAPI.NET.git |
| octolytics-dimension-user_id | 6154722 |
| octolytics-dimension-user_login | microsoft |
| octolytics-dimension-repository_id | 97175798 |
| octolytics-dimension-repository_nwo | microsoft/OpenAPI.NET |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 97175798 |
| octolytics-dimension-repository_network_root_nwo | microsoft/OpenAPI.NET |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | dd58d68a7813bbec9c91422c8c35f4af33832d70 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width