Skip to content

Commit

Permalink
修改本地绝对路径的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
xljiulang committed Jun 22, 2021
1 parent be35ba6 commit ddbb137
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions WebApiClientCore.OpenApi.SourceGenerator/OpenApiDoc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public OpenApiDoc(OpenApiDocOptions options)
{
if (string.IsNullOrEmpty(options.Namespace) == false)
{
this.Settings.NameSpace = options.Namespace;
this.Settings.NameSpace = options.Namespace;
this.Settings.CSharpGeneratorSettings.Namespace = options.Namespace;
}
}
Expand All @@ -64,14 +64,14 @@ public OpenApiDoc(OpenApiDocument document)
private static OpenApiDocument GetDocument(string openApi)
{
Console.WriteLine($"正在分析OpenApi:{openApi}");
if (Uri.TryCreate(openApi, UriKind.Absolute, out var _) == true)
if (Uri.TryCreate(openApi, UriKind.Absolute, out var api))
{
return OpenApiDocument.FromUrlAsync(openApi).Result;
}
else
{
return OpenApiDocument.FromFileAsync(openApi).Result;
if (api.Scheme.StartsWith(Uri.UriSchemeHttp, StringComparison.OrdinalIgnoreCase))
{
return OpenApiDocument.FromUrlAsync(openApi).Result;
}
}
return OpenApiDocument.FromFileAsync(openApi).Result;
}

/// <summary>
Expand Down

0 comments on commit ddbb137

Please sign in to comment.