Title: How to load external referenced fragments/documents? · microsoft/OpenAPI.NET · Discussion #679 · GitHub
Open Graph Title: How to load external referenced fragments/documents? · microsoft/OpenAPI.NET · Discussion #679
X Title: How to load external referenced fragments/documents? · microsoft/OpenAPI.NET · Discussion #679
Description: How to load external referenced fragments/documents?
Open Graph Description: I have the following two documents: Demo-API.v1.yaml openapi: 3.0.0 info: title: Demo API version: '1.0' servers: - url: / paths: /: get: summary: Your GET endpoint tags: [] responses: '200': descr...
X Description: I have the following two documents: Demo-API.v1.yaml openapi: 3.0.0 info: title: Demo API version: '1.0' servers: - url: / paths: /: get: summary: Your GET endpoint tags: [] responses: '...
Opengraph URL: https://github.com/microsoft/OpenAPI.NET/discussions/679
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"QAPage","mainEntity":{"@type":"Question","name":"How to load external referenced fragments/documents?","text":"I have the following two documents:
\nDemo-API.v1.yaml
\nopenapi: 3.0.0\ninfo:\n title: Demo API\n version: '1.0'\nservers:\n - url: /\npaths:\n /:\n get:\n summary: Your GET endpoint\n tags: []\n responses:\n '200':\n description: OK\n content:\n application/json:\n schema:\n type: string\n operationId: get-hi\n parameters:\n - schema:\n type: string\n in: query\n name: message\n /ping:\n get:\n summary: Your GET endpoint\n tags: []\n responses:\n '200':\n description: OK\n content:\n application/json:\n schema:\n type: string\n operationId: get-ping\n /pong:\n $ref: './Paths.v1.yaml#/pong'\ncomponents:\n schemas: {}
\nPaths.v1.yaml
\npong:\n get:\n summary: Your GET endpoint\n tags: []\n responses:\n '200':\n description: OK\n content:\n application/json:\n schema:\n type: string
\nBoth files are in the same folder, but I cannot get the OpenApiStreamReader to load the content of Paths.v1.yaml into the Demo-API.v1.yaml document. My latest attempt looks like this:
\nvar openApiReader = new OpenApiStreamReader(new OpenApiReaderSettings\n{\n BaseUrl = new Uri(\"file://C:\\\\source\\\\temp\\\\ConsoleApp1\\\\ConsoleApp1\\\\reference\"),\n ReferenceResolution = ReferenceResolutionSetting.ResolveAllReferences,\n});\n\nvar readResult = await openApiReader.ReadAsync(\n File.OpenRead(@\"C:\\\\source\\\\temp\\\\ConsoleApp1\\\\ConsoleApp1\\\\reference\\\\Demo-API.v1.yaml\"));
\nHowever, the content of the pong path item has UnresolvedReference: true and is otherwise empty.
\nWhat am I missing here?
\nVersion: 1.3.0-preview as well as the sources locally on my machine.
\n.NET: 6
","upvoteCount":1,"answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"The code to make this happen is still work in progress. If when you write out the result you set it to inline, the results, it should include the referenced file in the output. I'm hoping to get this fixed in the next couple of weeks.
","upvoteCount":2,"url":"https://github.com/microsoft/OpenAPI.NET/discussions/679#discussioncomment-1998810"}}}
| route-pattern | /_view_fragments/Voltron::DiscussionsFragmentsController/show/:user_id/:repository/:discussion_number/discussion_layout(.:format) |
| route-controller | voltron_discussions_fragments |
| route-action | discussion_layout |
| fetch-nonce | v2:e5ba7da6-1641-d012-c4ad-ad76a20a06e8 |
| current-catalog-service-hash | 9f0abe34da433c9b6db74bffa2466494a717b579a96b30a5d252e5090baea7be |
| request-id | E1CE:1611D:7DA17D:AC71B1:69811AAC |
| html-safe-nonce | b03a28114c8525d0ccd64c8d58fdbd49636a97591d2840149a8af8fcddea7999 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMUNFOjE2MTFEOjdEQTE3RDpBQzcxQjE6Njk4MTFBQUMiLCJ2aXNpdG9yX2lkIjoiNjE0NTEwOTYyOTcyMzU0ODMzMiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 61f6e78dc8a08a4a8b9aa30f95dcbc81a968f3dcdcbc25cf6f35caf704101cfa |
| hovercard-subject-tag | discussion:3782290 |
| github-keyboard-shortcuts | repository,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/Voltron::DiscussionsFragmentsController/show/microsoft/OpenAPI.NET/679/discussion_layout |
| twitter:image | https://opengraph.githubassets.com/a1bebd98398edc8417f02412d1d4114a7a63ef1dc3405c1c304bccead9829c19/microsoft/OpenAPI.NET/discussions/679 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a1bebd98398edc8417f02412d1d4114a7a63ef1dc3405c1c304bccead9829c19/microsoft/OpenAPI.NET/discussions/679 |
| og:image:alt | I have the following two documents: Demo-API.v1.yaml openapi: 3.0.0 info: title: Demo API version: '1.0' servers: - url: / paths: /: get: summary: Your GET endpoint tags: [] responses: '200': descr... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 39fe8101494cbb823c09b619b68c80cd4d05ab7279997038dbe06bb91608abe1 |
| 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 | d5b34a4e4898b066c629879feb4b184bc471d6a7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width