From d711fea88d8bcedde8757617bec26fe3fa003620 Mon Sep 17 00:00:00 2001 From: Andrew Omondi Date: Fri, 3 May 2024 12:01:15 +0300 Subject: [PATCH] Aligns plugin naming --- CHANGELOG.md | 2 ++ src/Kiota.Builder/Plugins/PluginsGenerationService.cs | 7 ++++--- .../Plugins/PluginsGenerationServiceTests.cs | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 16b5a8ec98..1ab494f4d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Aligns naming of sliced OpenAPI description generated by `plugin add` should be named `-openapi.json|yml` + ## [1.14.0] - 2024-05-02 ### Added diff --git a/src/Kiota.Builder/Plugins/PluginsGenerationService.cs b/src/Kiota.Builder/Plugins/PluginsGenerationService.cs index 92938a66b4..07a4a03ac5 100644 --- a/src/Kiota.Builder/Plugins/PluginsGenerationService.cs +++ b/src/Kiota.Builder/Plugins/PluginsGenerationService.cs @@ -36,11 +36,12 @@ public PluginsGenerationService(OpenApiDocument document, OpenApiUrlTreeNode ope } private static readonly OpenAPIRuntimeComparer _openAPIRuntimeComparer = new(); private const string ManifestFileNameSuffix = ".json"; - private const string DescriptionRelativePath = "openapi.yml"; + private const string DescriptionPathSuffix = "openapi.yml"; public async Task GenerateManifestAsync(CancellationToken cancellationToken = default) { // write the description - var descriptionFullPath = Path.Combine(Configuration.OutputPath, DescriptionRelativePath); + var descriptionRelativePath = $"{Configuration.ClientClassName.ToLowerInvariant()}-{DescriptionPathSuffix}"; + var descriptionFullPath = Path.Combine(Configuration.OutputPath, descriptionRelativePath); var directory = Path.GetDirectoryName(descriptionFullPath); if (!string.IsNullOrEmpty(directory) && !Directory.Exists(directory)) Directory.CreateDirectory(directory); @@ -64,7 +65,7 @@ public async Task GenerateManifestAsync(CancellationToken cancellationToken = de switch (pluginType) { case PluginType.Microsoft: - var pluginDocument = GetManifestDocument(DescriptionRelativePath); + var pluginDocument = GetManifestDocument(descriptionRelativePath); pluginDocument.Write(writer); break; case PluginType.APIManifest: diff --git a/tests/Kiota.Builder.Tests/Plugins/PluginsGenerationServiceTests.cs b/tests/Kiota.Builder.Tests/Plugins/PluginsGenerationServiceTests.cs index c5d9ee93f1..d638375cce 100644 --- a/tests/Kiota.Builder.Tests/Plugins/PluginsGenerationServiceTests.cs +++ b/tests/Kiota.Builder.Tests/Plugins/PluginsGenerationServiceTests.cs @@ -77,5 +77,5 @@ public async Task GeneratesManifest() Assert.Equal(OpenApiFileName, resultingManifest.Document.Runtimes.OfType().First().Spec.Url); } private const string ManifestFileName = "client-microsoft.json"; - private const string OpenApiFileName = "openapi.yml"; + private const string OpenApiFileName = "client-openapi.yml"; }