Skip to content

Commit

Permalink
Make sure we dont have double periods.
Browse files Browse the repository at this point in the history
  • Loading branch information
SilasKenneth committed May 21, 2024
1 parent 6285d2a commit a52d420
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Kiota.Builder/Refiners/GoRefiner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit a52d420

Please sign in to comment.