Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renames name_to_be_defined plugin type to apiplugin #4777

Merged
merged 3 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@
"--type",
"ApiManifest",
"--type",
"microsoft",
"ApiPlugin",
"--type",
"OpenAI"
],
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/Kiota.Builder/PluginType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ public enum PluginType
{
OpenAI,
APIManifest,
Microsoft
APIPlugin
}
5 changes: 3 additions & 2 deletions src/Kiota.Builder/Plugins/PluginsGenerationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@

switch (pluginType)
{
case PluginType.Microsoft:
case PluginType.APIPlugin:
var pluginDocument = GetManifestDocument(descriptionRelativePath);
pluginDocument.Write(writer);
break;
case PluginType.APIManifest:
var apiManifest = new ApiManifestDocument("application"); //TODO add application name

Check warning on line 75 in src/Kiota.Builder/Plugins/PluginsGenerationService.cs

View workflow job for this annotation

GitHub Actions / Build

Complete the task associated to this 'TODO' comment. (https://rules.sonarsource.com/csharp/RSPEC-1135)

Check warning on line 75 in src/Kiota.Builder/Plugins/PluginsGenerationService.cs

View workflow job for this annotation

GitHub Actions / Build

Complete the task associated to this 'TODO' comment. (https://rules.sonarsource.com/csharp/RSPEC-1135)
// pass empty config hash so that its not included in this manifest.
apiManifest.ApiDependencies.AddOrReplace(Configuration.ClientClassName, Configuration.ToApiDependency(string.Empty, TreeNode?.GetRequestInfo().ToDictionary(static x => x.Key, static x => x.Value) ?? [], WorkingDirectory));
var publisherName = string.IsNullOrEmpty(OAIDocument.Info?.Contact?.Name)
Expand Down Expand Up @@ -173,9 +173,10 @@
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 ???

Check warning on line 179 in src/Kiota.Builder/Plugins/PluginsGenerationService.cs

View workflow job for this annotation

GitHub Actions / Build

Complete the task associated to this 'TODO' comment. (https://rules.sonarsource.com/csharp/RSPEC-1135)

Check warning on line 179 in src/Kiota.Builder/Plugins/PluginsGenerationService.cs

View workflow job for this annotation

GitHub Actions / Build

Complete the task associated to this 'TODO' comment. (https://rules.sonarsource.com/csharp/RSPEC-1135)
DescriptionForHuman = descriptionForHuman,
DescriptionForModel = manifestInfo.DescriptionForModel ?? descriptionForHuman,
ContactEmail = manifestInfo.ContactEmail,
Expand Down Expand Up @@ -249,7 +250,7 @@
.Union(pathItem.Parameters.Where(static x => x.In is ParameterLocation.Path))
.Where(static x => x.Schema?.Type is not null && scalarTypes.Contains(x.Schema.Type))
.ToArray();
//TODO add request body

Check warning on line 253 in src/Kiota.Builder/Plugins/PluginsGenerationService.cs

View workflow job for this annotation

GitHub Actions / Build

Complete the task associated to this 'TODO' comment. (https://rules.sonarsource.com/csharp/RSPEC-1135)

Check warning on line 253 in src/Kiota.Builder/Plugins/PluginsGenerationService.cs

View workflow job for this annotation

GitHub Actions / Build

Complete the task associated to this 'TODO' comment. (https://rules.sonarsource.com/csharp/RSPEC-1135)

functions.Add(new Function
{
Expand All @@ -270,7 +271,7 @@
Type = x.Schema.Type ?? string.Empty,
Description = x.Description.CleanupXMLString(),
Default = x.Schema.Default?.ToString() ?? string.Empty,
//TODO enums

Check warning on line 274 in src/Kiota.Builder/Plugins/PluginsGenerationService.cs

View workflow job for this annotation

GitHub Actions / Build

Complete the task associated to this 'TODO' comment. (https://rules.sonarsource.com/csharp/RSPEC-1135)

Check warning on line 274 in src/Kiota.Builder/Plugins/PluginsGenerationService.cs

View workflow job for this annotation

GitHub Actions / Build

Complete the task associated to this 'TODO' comment. (https://rules.sonarsource.com/csharp/RSPEC-1135)
})),
Required = oasParameters.Where(static x => x.Required).Select(static x => x.Name).ToList()
},
Expand Down Expand Up @@ -321,5 +322,5 @@
return null;
}
private static readonly HashSet<string> scalarTypes = new(StringComparer.OrdinalIgnoreCase) { "string", "number", "integer", "boolean" };
//TODO validate this is right, in OAS integer are under type number for the json schema, but integer is ok for query parameters

Check warning on line 325 in src/Kiota.Builder/Plugins/PluginsGenerationService.cs

View workflow job for this annotation

GitHub Actions / Build

Complete the task associated to this 'TODO' comment. (https://rules.sonarsource.com/csharp/RSPEC-1135)

Check warning on line 325 in src/Kiota.Builder/Plugins/PluginsGenerationService.cs

View workflow job for this annotation

GitHub Actions / Build

Complete the task associated to this 'TODO' comment. (https://rules.sonarsource.com/csharp/RSPEC-1135)
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
Expand Down Expand Up @@ -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";

Expand Down Expand Up @@ -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
};
Expand Down
Loading