Skip to content

Commit

Permalink
Merge branch 'main' into shem/restore_request_configuration_classes
Browse files Browse the repository at this point in the history
  • Loading branch information
shemogumbe authored Apr 30, 2024
2 parents 8a6fd91 + ac8cea1 commit af3de83
Show file tree
Hide file tree
Showing 14 changed files with 226 additions and 17 deletions.
3 changes: 3 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ updates:
kiota-dependencies:
patterns:
- "*kiota*"
eslint:
patterns:
- "*eslint*"

- package-ecosystem: npm
directory: "/vscode/microsoft-kiota"
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Suppress CS1591 when generating CSharp code and documentation is not available
- Added file name suffix escaping in Go to avoid generating files with reserved suffixes. [#4407](https://github.com/microsoft/kiota/issues/4407)
- Added `KIOTA_OFFLINE_ENABLED` environment variable to disable checking for updates before each command. [#4556](https://github.com/microsoft/kiota/issues/4556)

### Changed

Expand All @@ -21,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fixes request builder disambiguation when child nodes had different prefixes for different paths with same parameters.[#4448](https://github.com/microsoft/kiota/issues/4448)
- Do not generate CS8603 warnings when enabling backing store in CSharp generation.
- Fixed excluding operation. [#4399](https://github.com/microsoft/kiota/issues/4399)
- Fixed plugin generation of `ApiManifest` type to not include the `x-ms-kiota-hash` in the generated plugin. [#4561](https://github.com/microsoft/kiota/issues/4561)

## [1.13.0] - 2024-04-04

Expand Down
115 changes: 107 additions & 8 deletions it/typescript/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion it/typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"@es-exec/esbuild-plugin-start": "^0.0.5",
"@types/node": "^20.12.7",
"@typescript-eslint/eslint-plugin": "^7.7.1",
"@typescript-eslint/parser": "^7.7.1",
"@typescript-eslint/parser": "^7.8.0",
"esbuild": "^0.20.2",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
Expand Down
9 changes: 6 additions & 3 deletions src/Kiota.Builder/Configuration/GenerationConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,14 @@ public ApiDependency ToApiDependency(string configurationHash, Dictionary<string
{
ApiDescriptionUrl = OpenAPIFilePath,
ApiDeploymentBaseUrl = ApiRootUrl?.EndsWith('/') ?? false ? ApiRootUrl : $"{ApiRootUrl}/",
Extensions = new() {
{ KiotaHashManifestExtensionKey, JsonValue.Create(configurationHash)}
},
Extensions = new(),
Requests = templatesWithOperations.SelectMany(static x => x.Value.Select(y => new RequestInfo { Method = y.ToUpperInvariant(), UriTemplate = x.Key.DeSanitizeUrlTemplateParameter() })).ToList(),
};

if (!string.IsNullOrEmpty(configurationHash))
{
dependency.Extensions.Add(KiotaHashManifestExtensionKey, JsonValue.Create(configurationHash));// only include non empty value.
}
return dependency;
}
public bool IsPluginConfiguration => PluginTypes.Count != 0;
Expand Down
3 changes: 2 additions & 1 deletion src/Kiota.Builder/Plugins/PluginsGenerationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ public async Task GenerateManifestAsync(CancellationToken cancellationToken = de
break;
case PluginType.APIManifest:
var apiManifest = new ApiManifestDocument("application"); //TODO add application name

Check warning on line 68 in src/Kiota.Builder/Plugins/PluginsGenerationService.cs

View workflow job for this annotation

GitHub Actions / Build

Complete the task associated to this 'TODO' comment. (https://rules.sonarsource.com/csharp/RSPEC-1135)
apiManifest.ApiDependencies.AddOrReplace(Configuration.ClientClassName, Configuration.ToApiDependency(OAIDocument.HashCode ?? string.Empty, TreeNode?.GetRequestInfo().ToDictionary(static x => x.Key, static x => x.Value) ?? []));
// pass empty cong hash so that its not included in this manifest.
apiManifest.ApiDependencies.AddOrReplace(Configuration.ClientClassName, Configuration.ToApiDependency(string.Empty, TreeNode?.GetRequestInfo().ToDictionary(static x => x.Key, static x => x.Value) ?? []));
apiManifest.Write(writer);
break;
case PluginType.OpenAI://TODO add support for OpenAI plugin type generation

Check warning on line 73 in src/Kiota.Builder/Plugins/PluginsGenerationService.cs

View workflow job for this annotation

GitHub Actions / Build

Complete the task associated to this 'TODO' comment. (https://rules.sonarsource.com/csharp/RSPEC-1135)
Expand Down
5 changes: 5 additions & 0 deletions src/kiota/Handlers/BaseKiotaCommandHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ public int Invoke(InvocationContext context)
}
protected async Task CheckForNewVersionAsync(ILogger logger, CancellationToken cancellationToken)
{
if (Configuration.Update.Disabled)
{
return;
}

var updateService = new UpdateService(httpClient, logger, Configuration.Update);
var result = await updateService.GetUpdateMessageAsync(Kiota.Generated.KiotaVersion.Current(), cancellationToken).ConfigureAwait(false);
if (!string.IsNullOrEmpty(result))
Expand Down
1 change: 0 additions & 1 deletion src/kiota/Handlers/Plugin/GenerateHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,5 @@ public override async Task<int> InvokeAsync(InvocationContext context)
#endif
}
}
throw new NotImplementedException();
}
}
1 change: 1 addition & 0 deletions src/kiota/KiotaConfigurationExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public static void BindConfiguration(this KiotaConfiguration configObject, IConf
{
ArgumentNullException.ThrowIfNull(configObject);
ArgumentNullException.ThrowIfNull(configuration);
configObject.Update.Disabled = bool.TryParse(configuration["OFFLINE_ENABLED"], out var disableUpdate) && disableUpdate;
configObject.Download.CleanOutput = bool.TryParse(configuration[$"{nameof(configObject.Download)}:{nameof(DownloadConfiguration.CleanOutput)}"], out var downloadCleanOutput) && downloadCleanOutput;
configObject.Download.ClearCache = bool.TryParse(configuration[$"{nameof(configObject.Download)}:{nameof(DownloadConfiguration.ClearCache)}"], out var downloadClearCache) && downloadClearCache;
configObject.Download.OutputPath = configuration[$"{nameof(configObject.Download)}:{nameof(DownloadConfiguration.OutputPath)}"] is string value && !string.IsNullOrEmpty(value) ? value : configObject.Download.OutputPath;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,30 @@ public void ToApiDependency()
{ "foo/bar", new HashSet<string>{"GET"}}
});
Assert.NotNull(apiDependency);
Assert.NotNull(apiDependency.Extensions);
Assert.Equal("foo", apiDependency.Extensions[GenerationConfiguration.KiotaHashManifestExtensionKey].GetValue<string>());
Assert.NotEmpty(apiDependency.Requests);
Assert.Equal("foo/bar", apiDependency.Requests[0].UriTemplate);
Assert.Equal("GET", apiDependency.Requests[0].Method);
}
[Fact]
public void ToApiDependencyDoesNotIncludeConfigHashIfEmpty()
{
var generationConfiguration = new GenerationConfiguration
{
ClientClassName = "class1",
IncludePatterns = null,
OpenAPIFilePath = "https://pet.store/openapi.yaml",
ApiRootUrl = "https://pet.store/api",
};
var apiDependency = generationConfiguration.ToApiDependency(string.Empty, new Dictionary<string, HashSet<string>>{
{ "foo/bar", new HashSet<string>{"GET"}}
});
Assert.NotNull(apiDependency);
Assert.NotNull(apiDependency.Extensions);
Assert.False(apiDependency.Extensions.ContainsKey(GenerationConfiguration.KiotaHashManifestExtensionKey));
Assert.NotEmpty(apiDependency.Requests);
Assert.Equal("foo/bar", apiDependency.Requests[0].UriTemplate);
Assert.Equal("GET", apiDependency.Requests[0].Method);
}
}
42 changes: 42 additions & 0 deletions vscode/microsoft-kiota/l10n/bundle.l10n.pl.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"Client will be upgraded from version {0} to {1}, upgrade your dependencies": "Klient zostanie zaktualizowany z wersji {0} do {1}, zaktualizuj swoje zależności",
"No description found, select a description first": "Nie znaleziono opisu, najpierw wybierz opis",
"No endpoints selected, select endpoints first": "Nie wybrano endpointów, najpierw wybierz endpointy",
"No workspace folder found, open a folder first": "Nie znaleziono folderu dla przestrzeni roboczej, najpierw otwórz folder",
"Yes": "Tak",
"No": "Nie",
"not found": "nie znaleziono",
"error updating the clients {error}": "błąd podczas aktualizacji klientów {error}",
"updating client with path {path}": "aktualizacja klienta o ścieżce {path}",
"Kiota Dependencies Information": "Informacje o zależnościach Kiota",
"Installation commands": "Polecenia instalacji",
"Dependencies": "Zależności",
"No language selected, select a language first": "Nie wybrano języka, najpierw wybierz język",
"Open an API description": "Otwórz opis API",
"A path or url to an OpenAPI description": "Ścieżka lub adres URL do opisu OpenAPI",
"Search for an API description": "Szukaj opisu API",
"Enter a search query": "Wprowadź zapytanie do wyszukania",
"Pick a search result": "Wybierz wynik wyszukiwania",
"Generate an API client": "Wygeneruj klienta API",
"Choose a name for the client class": "Wybierz nazwę klasy klienta",
"Choose a name for the client class namespace": "Wybierz nazwę dla namespace'a klasy klienta",
"Enter an output path relative to the root of the project": "Wprowadź ścieżkę wyjściową względem głównego katalogu projektu",
"Pick a language": "Wybierz język",
"Downloading kiota requires an internet connection. Please check your connection and try again.": "Pobieranie Kiota wymaga połączenia z internetem. Sprawdź swoje połączenie i spróbuj ponownie.",
"Kiota download failed. Try closing all Visual Studio Code windows and open only one. Check the extension host logs for more information.": "Pobieranie Kiota nie powiodło się. Spróbuj zamknąć wszystkie okna Visual Studio Code i otwórz tylko jedno. Sprawdź logi extension hosta w celu uzyskania dodatkowych informacji.",
"Downloading kiota...": "Pobieranie Kiota...",
"Generating client...": "Generowanie klienta...",
"Updating clients...": "Aktualizowanie klientów...",
"Loading...": "Ładowanie...",
"Pick a lock file": "Wybierz plik lock",
"Open a lock file": "Otwórz plik lock",
"Filter the API description": "Filtruj opis API",
"Enter a filter": "Wprowadź filtr",
"Searching...": "Wyszukiwanie...",
"A path or URL to an API manifest": "Ścieżka lub adres URL do manifestu API",
"Open an API manifest": "Otwórz manifest API",
"Invalid URL, please check the documentation for the supported URLs": "Nieprawidłowy adres URL, sprawdź dokumentację żeby dowiedzieć się jakie są obsługiwane adresy URL",
"No content found in the clipboard": "Nie znaleziono zawartości w schowku",
"Invalid content found in the clipboard": "Znaleziono nieprawidłową zawartość w schowku",
"Select an API manifest key": "Wybierz klucz manifestu API"
}
4 changes: 2 additions & 2 deletions vscode/microsoft-kiota/l10n/bundle.l10n.tr.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"Generate an API client": "Bir API istemcisi oluşturun",
"Choose a name for the client class": "İstemci sınıfı için bir isim seçin",
"Choose a name for the client class namespace": "İstemci sınıfı isim alanı için bir isim seçin",
"Enter an output path relative to the root of the project": "Proje köküne göre bir çıktı yolu girin",
"Enter an output path relative to the root of the project": "Proje kök dizinine göre bir çıktı yolu girin",
"Pick a language": "Bir dil seçin",
"Downloading kiota requires an internet connection. Please check your connection and try again.": "Kiota'nın indirilmesi bir internet bağlantısı gerektirir. Lütfen bağlantınızı kontrol edin ve tekrar deneyin.",
"Kiota download failed. Try closing all Visual Studio Code windows and open only one. Check the extension host logs for more information.": "Kiota indirme işlemi başarısız oldu. Tüm Visual Studio Code pencerelerini kapatmayı ve yalnızca birini açmayı deneyin. Daha fazla bilgi için extension host loglarını kontrol edin.",
Expand All @@ -32,7 +32,7 @@
"Open a lock file": "Bir kilit dosyası açın",
"Filter the API description": "API açıklamasını filtreleyin",
"Enter a filter": "Filtre girin",
"Searching...": "Araştırıcı...",
"Searching...": "Aranıyor...",
"A path or URL to an API manifest": "API manifestinin yolu veya URLsi",
"Open an API manifest": "API manifestini açın",
"Invalid URL, please check the documentation for the supported URLs": "Geçersiz URL, lütfen desteklenen URL'ler için dokümanları kontrol edin",
Expand Down
Loading

0 comments on commit af3de83

Please sign in to comment.