From a52d4205d036d677d763deceb55029fd31db1cf9 Mon Sep 17 00:00:00 2001 From: Silas Kenneth Date: Tue, 21 May 2024 12:19:03 +0300 Subject: [PATCH] Make sure we dont have double periods. --- src/Kiota.Builder/Refiners/GoRefiner.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Kiota.Builder/Refiners/GoRefiner.cs b/src/Kiota.Builder/Refiners/GoRefiner.cs index 96d47d236e..113d1399c7 100644 --- a/src/Kiota.Builder/Refiners/GoRefiner.cs +++ b/src/Kiota.Builder/Refiners/GoRefiner.cs @@ -768,7 +768,13 @@ private void NormalizeNamespaceNames(CodeElement currentElement) if (namespaceName.StartsWith(clientNamespace, StringComparison.OrdinalIgnoreCase) && !namespaceName.Equals(clientNamespace, StringComparison.OrdinalIgnoreCase)) { var secondPart = namespaceName[clientNamespace.Length..]; // The rest of the name after the clientNamespace - codeNamespace.Name = $"{clientNamespace}.{secondPart.ToLowerInvariant()}"; + var withEmptyRemoved = string.Join('.', secondPart.Split('.', StringSplitOptions.RemoveEmptyEntries)); + var normalizedString = string.IsNullOrEmpty(withEmptyRemoved) switch + { + true => string.Empty, + false => $".{withEmptyRemoved}" + }; + codeNamespace.Name = $"{clientNamespace}{normalizedString.ToLowerInvariant()}"; } } CrawlTree(currentElement, NormalizeNamespaceNames);