Skip to content

Commit

Permalink
Merge pull request #4598 from microsoft/andrueastman/fixOpenApiNaming
Browse files Browse the repository at this point in the history
Aligns naming of sliced OpenAPI description generated by `plugin add`
  • Loading branch information
andrueastman authored May 3, 2024
2 parents 7001650 + 2d4f9ea commit 9cf1bd0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions src/Kiota.Builder/Plugins/PluginsGenerationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}

0 comments on commit 9cf1bd0

Please sign in to comment.