Repository: microsoft/kiota (csharp)

Issue:
"name_to_be_defined" plugin should be changed to "apiplugin" type
We can choose 3 types when generating a plugin: `name_to_be_defined`, `openai` and `apimanifest`

`name_to_be_defined` should be changed to `apiplugin`.
`apiplugin` enable Copilot for Microsoft 365 to interact with REST APIs: https://learn.microsoft.com/en-us/microsoft-365-copilot/extensibility/overview-api-plugins and should follow the schema https://aka.ms/json-schemas/copilot-extensions/v2.1/plugin.schema.json

The generated `apiplugin` file should also contain the `$schema` property with the value `https://aka.ms/json-schemas/copilot-extensions/v2.1/plugin.schema.json`

Pull request:
Fixes https://github.com/microsoft/kiota/issues/4713

Patch:
diff --git a/.vscode/launch.json b/.vscode/launch.json
index df1e40d5f1..f4bcd561b3 100644
--- a/.vscode/launch.json
+++ b/.vscode/launch.json
@@ -352,7 +352,7 @@
         "--type",
         "ApiManifest",
         "--type",
-        "microsoft",
+        "ApiPlugin",
         "--type",
         "OpenAI"
       ],
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 98ce954783..bd385a7682 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -51,6 +51,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 - Fix scalar member composed type serialization in PHP [#2827](https://github.com/microsoft/kiota/issues/2827)
 - Trims unused components from output openApi document when generating plugins [#4672](https://github.com/microsoft/kiota/issues/4672)
 - Fixes missing imports for UntypedNode when backingstore is enabled in Java. 
+- Renames `name_to_be_defined` plugin type to `apiplugin` [#4713](https://github.com/microsoft/kiota/issues/4713)
 
 ## [1.14.0] - 2024-05-02
 
diff --git a/src/Kiota.Builder/PluginType.cs b/src/Kiota.Builder/PluginType.cs
index b985a129b0..c96bfa47b7 100644
--- a/src/Kiota.Builder/PluginType.cs
+++ b/src/Kiota.Builder/PluginType.cs
@@ -4,5 +4,5 @@ public enum PluginType
 {
     OpenAI,
     APIManifest,
-    Microsoft
+    APIPlugin
 }
diff --git a/src/Kiota.Builder/Plugins/PluginsGenerationService.cs b/src/Kiota.Builder/Plugins/PluginsGenerationService.cs
index 7b5daca469..2acad9f0de 100644
--- a/src/Kiota.Builder/Plugins/PluginsGenerationService.cs
+++ b/src/Kiota.Builder/Plugins/PluginsGenerationService.cs
@@ -67,7 +67,7 @@ public async Task GenerateManifestAsync(CancellationToken cancellationToken = de
 
             switch (pluginType)
             {
-                case PluginType.Microsoft:
+                case PluginType.APIPlugin:
                     var pluginDocument = GetManifestDocument(descriptionRelativePath);
                     pluginDocument.Write(writer);
                     break;
@@ -173,7 +173,8 @@ private PluginManifestDocument GetManifestDocument(string openApiDocumentPath)
         var manifestInfo = ExtractInfoFromDocument(OAIDocument.Info);
         return new PluginManifestDocument
         {
-            SchemaVersion = "v2",
+            Schema = "https://aka.ms/json-schemas/copilot-extensions/v2.1/plugin.schema.json",
+            SchemaVersion = "v2.1",
             NameForHuman = OAIDocument.Info?.Title.CleanupXMLString(),
             // TODO name for model ???
             DescriptionForHuman = descriptionForHuman,


Test patch:
diff --git a/tests/Kiota.Builder.Tests/Plugins/PluginsGenerationServiceTests.cs b/tests/Kiota.Builder.Tests/Plugins/PluginsGenerationServiceTests.cs
index d3b4e3cfbb..e67253a8c4 100644
--- a/tests/Kiota.Builder.Tests/Plugins/PluginsGenerationServiceTests.cs
+++ b/tests/Kiota.Builder.Tests/Plugins/PluginsGenerationServiceTests.cs
@@ -74,7 +74,7 @@ public async Task GeneratesManifest()
         {
             OutputPath = outputDirectory,
             OpenAPIFilePath = "openapiPath",
-            PluginTypes = [PluginType.Microsoft, PluginType.APIManifest, PluginType.OpenAI],
+            PluginTypes = [PluginType.APIPlugin, PluginType.APIManifest, PluginType.OpenAI],
             ClientClassName = "client",
             ApiRootUrl = "http://localhost/", //Kiota builder would set this for us
         };
@@ -108,7 +108,7 @@ public async Task GeneratesManifest()
         Assert.Equal(OpenApiFileName, v1Manifest.Document.Api.URL);
         Assert.Empty(v1Manifest.Problems);
     }
-    private const string ManifestFileName = "client-microsoft.json";
+    private const string ManifestFileName = "client-apiplugin.json";
     private const string OpenAIPluginFileName = "openai-plugins.json";
     private const string OpenApiFileName = "client-openapi.yml";
 
@@ -171,7 +171,7 @@ public async Task GeneratesManifestAndCleansUpInputDescription()
         {
             OutputPath = outputDirectory,
             OpenAPIFilePath = "openapiPath",
-            PluginTypes = [PluginType.Microsoft],
+            PluginTypes = [PluginType.APIPlugin],
             ClientClassName = "client",
             ApiRootUrl = "http://localhost/", //Kiota builder would set this for us
         };