diff --git a/CHANGELOG.md b/CHANGELOG.md
index cbbc07336b..f41fcb9db5 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
+## [1.10.1] - 2024-01-12
+
+### Added
+
+### Changed
+
+- Fixed an issue where domain expiration for apis.guru would lead to search failures.
+
## [1.10.0] - 2024-01-11
### Added
@@ -1213,3 +1221,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Initial GitHub release
+
diff --git a/src/Kiota.Builder/Kiota.Builder.csproj b/src/Kiota.Builder/Kiota.Builder.csproj
index bab3a69e99..327c53a3a5 100644
--- a/src/Kiota.Builder/Kiota.Builder.csproj
+++ b/src/Kiota.Builder/Kiota.Builder.csproj
@@ -15,7 +15,7 @@
Microsoft.OpenApi.Kiota.Builder
Microsoft.OpenApi.Kiota.Builder
./nupkg
- 1.11.0
+ 1.10.1
$(VersionSuffix)
https://github.com/microsoft/kiota/releases
diff --git a/src/Kiota.Builder/KiotaBuilder.cs b/src/Kiota.Builder/KiotaBuilder.cs
index b692c2f289..7f37bc05bd 100644
--- a/src/Kiota.Builder/KiotaBuilder.cs
+++ b/src/Kiota.Builder/KiotaBuilder.cs
@@ -25,6 +25,7 @@
using Kiota.Builder.Manifest;
using Kiota.Builder.OpenApiExtensions;
using Kiota.Builder.Refiners;
+using Kiota.Builder.SearchProviders.APIsGuru;
using Kiota.Builder.Validation;
using Kiota.Builder.Writers;
using Microsoft.Extensions.Logging;
@@ -411,7 +412,7 @@ private async Task LoadStream(string inputPath, CancellationToken cancel
{
ClearCache = config.ClearCache,
};
- var targetUri = new Uri(inputPath);
+ var targetUri = APIsGuruSearchProvider.ChangeSourceUrlToGitHub(new Uri(inputPath)); // so updating existing clients doesn't break
var fileName = targetUri.GetFileName() is string name && !string.IsNullOrEmpty(name) ? name : "description.yml";
input = await cachingProvider.GetDocumentAsync(targetUri, "generation", fileName, cancellationToken: cancellationToken).ConfigureAwait(false);
}
diff --git a/src/Kiota.Builder/SearchProviders/APIsGuru/APIsGuruSearchProvider.cs b/src/Kiota.Builder/SearchProviders/APIsGuru/APIsGuruSearchProvider.cs
index 14c5513931..223ed14b41 100644
--- a/src/Kiota.Builder/SearchProviders/APIsGuru/APIsGuruSearchProvider.cs
+++ b/src/Kiota.Builder/SearchProviders/APIsGuru/APIsGuruSearchProvider.cs
@@ -30,7 +30,7 @@ public APIsGuruSearchProvider(Uri searchUri, HttpClient httpClient, ILogger logg
public HashSet KeysToExclude
{
get; init;
- } = new() {
+ } = new(StringComparer.OrdinalIgnoreCase) {
"microsoft.com:graph"
};
public async Task> SearchAsync(string term, string? version, CancellationToken cancellationToken)
@@ -53,10 +53,14 @@ public async Task> SearchAsync(string term, st
.Where(static x => x.versionInfo is not null)
.DistinctBy(static x => x.Key, StringComparer.OrdinalIgnoreCase)
.ToDictionary(static x => x.Key,
- static x => new SearchResult(x.versionInfo!.info?.title ?? string.Empty, x.versionInfo.info?.description ?? string.Empty, x.versionInfo.info?.contact?.url, x.versionInfo.swaggerUrl, x.Item3 ?? Enumerable.Empty().ToList()),
+ static x => new SearchResult(x.versionInfo!.info?.title ?? string.Empty, x.versionInfo.info?.description ?? string.Empty, x.versionInfo.info?.contact?.url, ChangeSourceUrlToGitHub(x.versionInfo.swaggerUrl), x.Item3 ?? Enumerable.Empty().ToList()),
StringComparer.OrdinalIgnoreCase);
return results;
}
+ internal static Uri ChangeSourceUrlToGitHub(Uri original) =>
+ original.Host.StartsWith("api.apis.guru", StringComparison.OrdinalIgnoreCase) ?
+ new(original.ToString().Replace("https://api.apis.guru", "https://raw.githubusercontent.com/APIs-guru/openapi-directory/gh-pages", StringComparison.OrdinalIgnoreCase), UriKind.Absolute) :
+ original;
private static string GetVersionKey(bool singleCandidate, string? version, KeyValuePair x) => singleCandidate && !string.IsNullOrEmpty(version) ? version : x.Value.preferred;
}
diff --git a/src/kiota/kiota.csproj b/src/kiota/kiota.csproj
index 38bd2a1b10..2486df70d9 100644
--- a/src/kiota/kiota.csproj
+++ b/src/kiota/kiota.csproj
@@ -15,7 +15,7 @@
Microsoft.OpenApi.Kiota
Microsoft.OpenApi.Kiota
./nupkg
- 1.11.0
+ 1.10.1
$(VersionSuffix)
https://github.com/microsoft/kiota/releases
diff --git a/tests/Kiota.Builder.Tests/KiotaSearcherTests.cs b/tests/Kiota.Builder.Tests/KiotaSearcherTests.cs
index b022115b4a..b6bf3c0fff 100644
--- a/tests/Kiota.Builder.Tests/KiotaSearcherTests.cs
+++ b/tests/Kiota.Builder.Tests/KiotaSearcherTests.cs
@@ -78,6 +78,10 @@ public async Task GetsGithubFromApisGuruWithExactMatch()
var searcher = new KiotaSearcher(new Mock>().Object, searchConfiguration, httpClient, null, null);
var results = await searcher.SearchAsync("apisguru::github.com:api.github.com.2022-11-28", string.Empty, new CancellationToken());
Assert.Single(results);
+ var result = results.First();
+ var resultUrl = result.Value.DescriptionUrl;
+ var bytes = await httpClient.GetByteArrayAsync(resultUrl);
+ Assert.NotEmpty(bytes);
}
public void Dispose()
{