Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try to fix delete functionality #151

Merged
merged 1 commit into from
Nov 17, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
7 changes: 6 additions & 1 deletion tools/code/common/CommonTypes.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Flurl;
using Flurl;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
Expand Down Expand Up @@ -151,6 +151,11 @@ public static string GetName(this IArtifactDirectory directory)
return directory.GetDirectoryInfo().Name;
}

public static bool DirectoryExists(this IArtifactDirectory directory)
{
return directory.GetDirectoryInfo().Exists;
}

public static IEnumerable<FileInfo> EnumerateFilesRecursively(this IArtifactDirectory directory)
{
return directory.GetDirectoryInfo()
Expand Down
6 changes: 3 additions & 3 deletions tools/code/publisher/Api.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using common;
using common;
using Microsoft.Extensions.Logging;
using Microsoft.OpenApi;
using Microsoft.OpenApi.Extensions;
Expand Down Expand Up @@ -253,10 +253,10 @@ public static ApiUri GetApiUri(ApiName apiName, ServiceUri serviceUri)

private static ApiSpecificationFile? TryGetExistingSpecificationFile(ApiDirectory apiDirectory, ServiceDirectory serviceDirectory)
{
return apiDirectory.GetDirectoryInfo()
return apiDirectory.DirectoryExists() ? apiDirectory.GetDirectoryInfo()
.EnumerateFiles()
.Choose(file => TryGetApiSpecificationFile(file, serviceDirectory))
.FirstOrDefault();
.FirstOrDefault() : null;
}

private static async ValueTask PutApi(ApiName apiName, ApiInformationFile? apiInformationFile, ApiSpecificationFile? specificationFile, JsonObject? configurationApiJson, ServiceUri serviceUri, PutRestResource putRestResource, ILogger logger, CancellationToken cancellationToken)
Expand Down