Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/Microsoft.OpenApi/Reader/OpenApiJsonReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@ private JsonNode LoadJsonNodes(TextReader input)
private async Task<OpenApiDiagnostic> LoadExternalRefs(OpenApiDocument document, CancellationToken cancellationToken, OpenApiReaderSettings settings, string format = null)
{
// Create workspace for all documents to live in.
var openApiWorkSpace = new OpenApiWorkspace();
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);
Expand Down
11 changes: 10 additions & 1 deletion src/Microsoft.OpenApi/Reader/Services/DefaultStreamLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,16 @@
/// <exception cref="ArgumentException"></exception>
public async Task<Stream> LoadAsync(Uri uri)
{
var absoluteUri = new Uri(baseUrl, uri);
Uri absoluteUri;
if (baseUrl.Equals(OpenApiConstants.BaseRegistryUri))
{
// use current working directory
absoluteUri = new Uri(Directory.GetCurrentDirectory() + uri);
}
else
{
absoluteUri = new Uri(baseUrl, uri);
}

switch (absoluteUri.Scheme)
{
Expand Down
Loading