Skip to content

Commit

Permalink
Merge pull request #4586 from microsoft/bugfix/spec-relative-path
Browse files Browse the repository at this point in the history
- fixes manifest serialization
  • Loading branch information
andrueastman authored May 2, 2024
2 parents 89d7680 + 393179b commit cf49c32
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- Fixed a bug where the Microsoft Plugin Manifests would start with relative paths. [#4583](https://github.com/microsoft/kiota/issues/4583)
- Fixed a bug where TypeScript deserialization would fail on Uppercase properties.[#4479](https://github.com/microsoft/kiota/issues/4479)
- Changed URI template generation to reuse templates when required templates are absent across operations.
- Fixed path deduplication logic to avoid double `Id` suffixes in indexer names in scenarios where the `Id` suffix is already present.[#4519](https://github.com/microsoft/kiota/issues/4519)
- Fixed path deduplication logic to avoid double `Id` suffixes in indexer names in scenarios where the `Id` suffix is already present.[#4519](https://github.com/microsoft/kiota/issues/4519)
- Updated reserved name providers for Java and Php so that "object" can be escaped.
- Fixes request builder disambiguation when child nodes had different prefixes for different paths with same parameters.[#4448](https://github.com/microsoft/kiota/issues/4448)
- Fixes request builder disambiguation when child nodes had different prefixes for different paths with same parameters.[#4448](https://github.com/microsoft/kiota/issues/4448)
- Do not generate CS8603 warnings when enabling backing store in CSharp generation.
- Fixed excluding operation. [#4399](https://github.com/microsoft/kiota/issues/4399)
- Fixed plugin generation of `ApiManifest` type to not include the `x-ms-kiota-hash` in the generated plugin. [#4561](https://github.com/microsoft/kiota/issues/4561)
Expand Down
4 changes: 2 additions & 2 deletions src/Kiota.Builder/Plugins/PluginsGenerationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ 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 DescriptionRelativePath = "openapi.yml";
public async Task GenerateManifestAsync(CancellationToken cancellationToken = default)
{
// write the decription
Expand Down Expand Up @@ -136,7 +136,7 @@ descriptionExtension is OpenApiDescriptionForModelExtension extension &&
Auth = new AnonymousAuth(),
Spec = new OpenApiRuntimeSpec()
{
Url = openApiDocumentPath
Url = openApiDocumentPath,
},
RunForFunctions = [operation.OperationId]
});
Expand Down
13 changes: 11 additions & 2 deletions tests/Kiota.Builder.Tests/Plugins/PluginsGenerationServiceTests.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
using System;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Text.Json;
using System.Threading.Tasks;
using Kiota.Builder.Configuration;
using Kiota.Builder.Plugins;
using Microsoft.Extensions.Logging;
using Microsoft.OpenApi.Services;
using Microsoft.Plugins.Manifest;
using Moq;
using Xunit;

Expand Down Expand Up @@ -63,8 +66,14 @@ public async Task GeneratesManifest()
var pluginsGenerationService = new PluginsGenerationService(openApiDocument, urlTreeNode, generationConfiguration);
await pluginsGenerationService.GenerateManifestAsync();

Assert.True(File.Exists(Path.Combine(outputDirectory, "client-microsoft.json")));
Assert.True(File.Exists(Path.Combine(outputDirectory, ManifestFileName)));
Assert.True(File.Exists(Path.Combine(outputDirectory, "client-apimanifest.json")));
Assert.True(File.Exists(Path.Combine(outputDirectory, "openapi.yml")));
Assert.True(File.Exists(Path.Combine(outputDirectory, OpenApiFileName)));
var manifestContent = await File.ReadAllTextAsync(Path.Combine(outputDirectory, ManifestFileName));
using var jsonDocument = JsonDocument.Parse(manifestContent);
var resultingManifest = PluginManifestDocument.Load(jsonDocument.RootElement);
Assert.Equal(OpenApiFileName, resultingManifest.Document.Runtimes.OfType<OpenApiRuntime>().First().Spec.Url);
}
private const string ManifestFileName = "client-microsoft.json";
private const string OpenApiFileName = "openapi.yml";
}

0 comments on commit cf49c32

Please sign in to comment.