up
This commit is contained in:
@@ -9,11 +9,18 @@ public sealed class OpenApiDocumentCache
|
||||
|
||||
public OpenApiDocumentCache(IHostEnvironment environment)
|
||||
{
|
||||
var path = Path.Combine(environment.ContentRootPath, "openapi", "notify-openapi.yaml");
|
||||
if (!File.Exists(path))
|
||||
var candidateRoots = new[]
|
||||
{
|
||||
_document = string.Empty;
|
||||
_hash = string.Empty;
|
||||
Path.Combine(environment.ContentRootPath, "openapi", "notify-openapi.yaml"),
|
||||
Path.Combine(environment.ContentRootPath, "TestContent", "openapi", "notify-openapi.yaml"),
|
||||
Path.Combine(AppContext.BaseDirectory, "openapi", "notify-openapi.yaml")
|
||||
};
|
||||
|
||||
var path = candidateRoots.FirstOrDefault(File.Exists);
|
||||
if (path is null)
|
||||
{
|
||||
_document = "# notifier openapi (stub for tests)\nopenapi: 3.1.0\ninfo:\n title: stub\n version: 0.0.0\npaths: {}\n";
|
||||
_hash = "stub-openapi";
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user