Skip to content

Commit 3bb8595

Browse files
author
Guy Fankam
committed
Address #760
1 parent 77b9d42 commit 3bb8595

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/common/Api.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ from updatedDto in JsonObjectModule.From(formattedDtoObject, resource.Serializer
309309
}
310310

311311
/// <summary>
312-
/// If the API type is not 'websocket' or 'graphql', remove the 'serviceUrl' property from the API information file DTO.
312+
/// If the 'serviceUrl' property is empty, remove it. APIM doesn't support publishing blank service URLs.
313313
/// </summary>
314314
private static JsonObject FormatInformationFileDto(this ApiResource resource, JsonObject dtoJson)
315315
{
@@ -318,9 +318,9 @@ private static JsonObject FormatInformationFileDto(this ApiResource resource, Js
318318
var dto = JsonNodeModule.To<ApiDto>(dtoJson, serializerOptions)
319319
.IfErrorThrow();
320320

321-
dto = new[] { "websocket", "graphql" }.Contains(dto.Properties.Type, StringComparer.OrdinalIgnoreCase)
322-
? dto
323-
: dto with { Properties = dto.Properties with { ServiceUrl = null } };
321+
dto = string.IsNullOrWhiteSpace(dto.Properties.ServiceUrl)
322+
? dto with { Properties = dto.Properties with { ServiceUrl = null } }
323+
: dto;
324324

325325
return JsonObjectModule.From(dto, serializerOptions)
326326
.IfErrorThrow();

0 commit comments

Comments
 (0)