-
Notifications
You must be signed in to change notification settings - Fork 253
Relative reference in subdirectory OpenApi document fails to load #1674
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
closing since #2133 was merged |
@baywet The issue is still present. As the parameter With the current main branch, the following exception is thrown:
This exception occurs because the Uri is build from // Create workspace for all documents to live in.
var baseUrl = settings.BaseUrl ?? new Uri(OpenApiConstants.BaseRegistryUri);
var openApiWorkSpace = new OpenApiWorkspace(baseUrl);
// Load this root document into the workspace
var streamLoader = new DefaultStreamLoader(settings.BaseUrl);
var workspaceLoader = new OpenApiWorkspaceLoader(openApiWorkSpace, settings.CustomExternalLoader ?? streamLoader, settings); My expectation would be that the I wanted to start implementing a fix also for this issue, but I would like to get some understanding of the expected behavior with a few classes:
|
@dldl-cmd which version of the library are you testing with? |
Thanks for confirming! |
@baywet Yes, I would like to do a PR on this issue. I already look at some code pieces therefore I came up with the above questions. |
To answer your questions:
Let us know if you have any additional comments or questions. |
|
I think it'd make sense, feel free to startup a PR, seeing the code will make things a bit more concrete at this point. |
Relative references should be resolved in any implementation of IStreamLoader, not in an OpenAPIDocument. |
…crosoft#1674 Use OpenApiDocuments BaseUri as location of the document. This allows to have during loading further documents a base Url for retrieval, which can be combined with a relative Uri to get an absolute.
…crosoft#1674 Use OpenApiDocuments BaseUri as location of the document. This allows to have during loading further documents a base Url for retrieval, which can be combined with a relative Uri to get an absolute.
…crosoft#1674 Use OpenApiDocuments BaseUri as location of the document. This allows to have during loading further documents a base Url for retrieval, which can be combined with a relative Uri to get an absolute.
(#2243) * Fix: relative references in subdirectory documents are not loading #1674 Use OpenApiDocuments BaseUri as location of the document. This allows to have during loading further documents a base Url for retrieval, which can be combined with a relative Uri to get an absolute. * PR feedback: remove unnecessary variable * Fix loading on linux
Relative reference in subdirectory OpenApi document fails to load
When loading a document which is splitted into multiple documents relative references are failing to load when a parent document is in a subdirectory.
What happens is, that a
System.IO.FileNotFoundException
is thrown:Files to reproduce
OpenApi.NET Version: 1.6.14
./Root.json
./Directory/AllPets.json
./Directory/Pets.json
The text was updated successfully, but these errors were encountered: