diff --git a/CHANGELOG.md b/CHANGELOG.md index 8811159f84..7250b88e23 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Implemented partial class model declarations. [4894](https://github.com/microsoft/kiota/issues/4894) - Fixed a bug where the Go file names were too long +- Fixed a bug where the declarative copilot information would be erased if any. [#4935](https://github.com/microsoft/kiota/issues/4935) - Fixes bug with model names in Go generated from camel case namespace. [https://github.com/microsoftgraph/msgraph-sdk-go/issues/721] - Plugins OpenAPI extensions are only added when generating plugins to reduce the risk of parsing errors. [#4834](https://github.com/microsoft/kiota/issues/4834) - TypeScript imports are now using ES6 imports with the .js extension. diff --git a/src/Kiota.Builder/Plugins/Models/AppManifestModel.cs b/src/Kiota.Builder/Plugins/Models/AppManifestModel.cs index 5ef0fae47a..7b49477b9a 100644 --- a/src/Kiota.Builder/Plugins/Models/AppManifestModel.cs +++ b/src/Kiota.Builder/Plugins/Models/AppManifestModel.cs @@ -144,7 +144,8 @@ public string? Outline internal class CopilotExtensions { - public IList Plugins { get; set; } = new List(); + public IList Plugins { get; set; } = []; + public IList DeclarativeCopilots { get; set; } = []; } internal class Plugin @@ -158,3 +159,15 @@ public string? File get; set; } } + +internal class DeclarativeCopilot +{ + public string? Id + { + get; set; + } + public string? File + { + get; set; + } +} diff --git a/tests/Kiota.Builder.Tests/Plugins/PluginsGenerationServiceTests.cs b/tests/Kiota.Builder.Tests/Plugins/PluginsGenerationServiceTests.cs index 77469edd74..3390e7d49e 100644 --- a/tests/Kiota.Builder.Tests/Plugins/PluginsGenerationServiceTests.cs +++ b/tests/Kiota.Builder.Tests/Plugins/PluginsGenerationServiceTests.cs @@ -586,6 +586,12 @@ public async Task GeneratesManifestAndUpdatesExistingAppManifestWithExistingPlug ""id"": ""client"", ""file"": ""dummyFile.json"" } + ], + ""declarativeCopilots"": [ + { + ""id"": ""client"", + ""file"": ""dummyFile.json"" + } ] } }"; @@ -612,6 +618,9 @@ public async Task GeneratesManifestAndUpdatesExistingAppManifestWithExistingPlug Assert.NotNull(originalAppManifestModelObject.CopilotExtensions); Assert.Single(originalAppManifestModelObject.CopilotExtensions.Plugins);//one plugin present Assert.Equal("dummyFile.json", originalAppManifestModelObject.CopilotExtensions.Plugins[0].File); // no plugins present + Assert.Single(originalAppManifestModelObject.CopilotExtensions.DeclarativeCopilots);// one declarative copilot present + Assert.Equal("dummyFile.json", originalAppManifestModelObject.CopilotExtensions.DeclarativeCopilots[0].File); // no plugins present + // Run the plugin generation var pluginsGenerationService = new PluginsGenerationService(openApiDocument, urlTreeNode, generationConfiguration, workingDirectory); @@ -629,6 +638,8 @@ public async Task GeneratesManifestAndUpdatesExistingAppManifestWithExistingPlug Assert.Equal("Test Name", originalAppManifestModelObject.Developer.Name); // developer name is same Assert.Equal("client", appManifestModelObject.CopilotExtensions.Plugins[0].Id); Assert.Equal(ManifestFileName, appManifestModelObject.CopilotExtensions.Plugins[0].File);// file name is updated + Assert.Single(appManifestModelObject.CopilotExtensions.DeclarativeCopilots);// we didn't erase the existing declarative copilots + Assert.Equal("dummyFile.json", appManifestModelObject.CopilotExtensions.DeclarativeCopilots[0].File); // no plugins present } [Fact] public async Task GeneratesManifestAndCleansUpInputDescription()