diff --git a/src/Kiota.Builder/Plugins/PluginsGenerationService.cs b/src/Kiota.Builder/Plugins/PluginsGenerationService.cs index 63f1ad1c6e..667020730d 100644 --- a/src/Kiota.Builder/Plugins/PluginsGenerationService.cs +++ b/src/Kiota.Builder/Plugins/PluginsGenerationService.cs @@ -38,6 +38,9 @@ public async Task GenerateManifestAsync(CancellationToken cancellationToken = de { // write the decription var descriptionFullPath = Path.Combine(Configuration.OutputPath, DescriptionRelativePath); + var directory = Path.GetDirectoryName(descriptionFullPath); + if (!string.IsNullOrEmpty(directory) && !Directory.Exists(directory)) + Directory.CreateDirectory(directory); #pragma warning disable CA2007 // Consider calling ConfigureAwait on the awaited task await using var descriptionStream = File.Create(descriptionFullPath, 4096); await using var fileWriter = new StreamWriter(descriptionStream); @@ -50,9 +53,6 @@ public async Task GenerateManifestAsync(CancellationToken cancellationToken = de foreach (var pluginType in Configuration.PluginTypes) { var manifestOutputPath = Path.Combine(Configuration.OutputPath, $"{Configuration.ClientClassName.ToLowerInvariant()}-{pluginType.ToString().ToLowerInvariant()}{ManifestFileNameSuffix}"); - var directory = Path.GetDirectoryName(manifestOutputPath); - if (!string.IsNullOrEmpty(directory) && !Directory.Exists(directory)) - Directory.CreateDirectory(directory); #pragma warning disable CA2007 // Consider calling ConfigureAwait on the awaited task await using var fileStream = File.Create(manifestOutputPath, 4096); await using var writer = new Utf8JsonWriter(fileStream, new JsonWriterOptions { Indented = true }); diff --git a/tests/Kiota.Builder.Tests/Plugins/PluginsGenerationServiceTests.cs b/tests/Kiota.Builder.Tests/Plugins/PluginsGenerationServiceTests.cs index 5651aee580..77e2b4a638 100644 --- a/tests/Kiota.Builder.Tests/Plugins/PluginsGenerationServiceTests.cs +++ b/tests/Kiota.Builder.Tests/Plugins/PluginsGenerationServiceTests.cs @@ -33,6 +33,9 @@ public async Task GeneratesManifest() info: title: test version: 1.0 +servers: + - url: http://localhost/ + description: There's no place like home paths: /test: get: @@ -49,8 +52,9 @@ public async Task GeneratesManifest() { OutputPath = outputDirectory, OpenAPIFilePath = "openapiPath", - PluginTypes = [PluginType.Microsoft], + PluginTypes = [PluginType.Microsoft, PluginType.APIManifest], ClientClassName = "client", + ApiRootUrl = "http://localhost/", //Kiota builder would set this for us }; var (openAPIDocumentStream, _) = await openAPIDocumentDS.LoadStreamAsync(simpleDescriptionPath, generationConfiguration, null, false); var openApiDocument = await openAPIDocumentDS.GetDocumentFromStreamAsync(openAPIDocumentStream, generationConfiguration); @@ -60,6 +64,7 @@ public async Task GeneratesManifest() await pluginsGenerationService.GenerateManifestAsync(); Assert.True(File.Exists(Path.Combine(outputDirectory, "client-microsoft.json"))); + Assert.True(File.Exists(Path.Combine(outputDirectory, "client-apimanifest.json"))); Assert.True(File.Exists(Path.Combine(outputDirectory, "openapi.yml"))); } }