Repository: microsoft/kiota (csharp)

Issue:
Sliced OpenAPI description generated by plugin add should be named `<plugin-name>-openapi.json`
### What are you generating using Kiota, clients or plugins?

Kiota plugin

### In what context or format are you using Kiota?

Windows executable

### Client Library/SDK Language

None

### Describe the bug

When generating plugins we have the following:
- Plugin manifest types (one to any)
- Sliced OpenAPI based on the pre-selected endpoints

Today, the generated OpenAPI description is been named `openapi.json`

Some situations may require one to have more than 1 plugin into the same output directory, for example, building custom GPTs and having more than 1 plugin available.

### Expected behavior

Today, the `openapi.json` gets override every time a new plugin is generated is a output directory we already have a plugin. To avoid that, sliced OpenAPI descriptions should be named `<plugin-name>-openapi.json`.

### How to reproduce

Generate more than 1 plugin into the same output directory

### Open API description file

_No response_

### Kiota Version

plugin feature

### Latest Kiota version known to work for scenario above?(Not required)

_No response_

### Known Workarounds

_No response_

### Configuration

_No response_

### Debug output

<details><summary>Click to expand log</summary>
```


<log output here>

```
</details>


### Other information

_No response_

Pull request:
Aligns naming of sliced OpenAPI description generated by `plugin add` should be named `<plugin-name>-openapi.json|yml`

Closes https://github.com/microsoft/kiota/issues/4595

Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c766fd0c98..5d5b2b6b61 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,7 @@ 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 `<plugin-name>-openapi.json|yml`
 - Fixed RPC server to respect the `KIOTA_CONFIG_PREVIEW` flag.
 
 ## [1.14.0] - 2024-05-02
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:


Test patch:
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<OpenApiRuntime>().First().Spec.Url);
     }
     private const string ManifestFileName = "client-microsoft.json";
-    private const string OpenApiFileName = "openapi.yml";
+    private const string OpenApiFileName = "client-openapi.yml";
 }