Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 2 additions & 2 deletions src/Kiota.Builder/Kiota.Builder.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@
<PackageReference Include="DotNet.Glob" Version="3.1.3" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.2" />
<PackageReference Include="Microsoft.Kiota.Bundle" Version="1.17.1" />
<PackageReference Include="Microsoft.OpenApi" Version="2.0.0-preview9" />
<PackageReference Include="Microsoft.OpenApi" Version="2.0.0-preview.11" />
<PackageReference Include="Microsoft.OpenApi.ApiManifest" Version="2.0.0-preview1" />
<PackageReference Include="Microsoft.OpenApi.Readers" Version="2.0.0-preview9" />
<PackageReference Include="Microsoft.OpenApi.Readers" Version="2.0.0-preview.11" />
<PackageReference Include="Microsoft.DeclarativeAgents.Manifest" Version="2.0.0-rc2" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.13.2">
Expand Down
3 changes: 1 addition & 2 deletions src/Kiota.Builder/OpenApiDocumentDownloadService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ public OpenApiDocumentDownloadService(HttpClient httpClient, ILogger logger)
ArgumentNullException.ThrowIfNull(logger);
HttpClient = httpClient;
Logger = logger;
OpenApiReaderRegistry.RegisterReader(OpenApiConstants.Yaml, new OpenApiYamlReader());
OpenApiReaderRegistry.RegisterReader(OpenApiConstants.Yml, new OpenApiYamlReader());
}
private static readonly AsyncKeyedLocker<string> localFilesLock = new(o =>
{
Expand Down Expand Up @@ -118,6 +116,7 @@ ex is SecurityException ||

// Add all extensions for generation
settings.AddGenerationExtensions();
settings.AddYamlReader();
if (config.IsPluginConfiguration)
settings.AddPluginsExtensions();// Add all extensions for plugins

Expand Down
4 changes: 2 additions & 2 deletions src/Kiota.Builder/Plugins/PluginsGenerationService.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
Expand Down Expand Up @@ -470,7 +470,7 @@ private static (OpenApiRuntime[], Function[], ConversationStarter[]) GetRuntimes
var auth = configAuth;
try
{
auth = configAuth ?? GetAuth(operation.Security ?? document.SecurityRequirements ?? []);
auth = configAuth ?? GetAuth(operation.Security ?? document.Security ?? []);
}
catch (UnsupportedSecuritySchemeException e)
{
Expand Down
1 change: 0 additions & 1 deletion src/kiota/kiota.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="9.0.2" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.2" />
<PackageReference Include="Microsoft.OpenApi.ApiManifest" Version="2.0.0-preview1" />
<PackageReference Include="Microsoft.OpenApi.Readers" Version="2.0.0-preview9" />
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.13.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ public async Task GeneratesManifestAsync(string inputPluginName, string expected
paths:
/test:
get:
tags:
- test
summary: summary for test path
description: description for test path
responses:
Expand Down Expand Up @@ -261,7 +263,9 @@ public async Task GeneratesManifestAndCleansUpInputDescriptionAsync()

// Validate the original file.
using var originalOpenApiFile = File.OpenRead(simpleDescriptionPath);
var originalResult = await OpenApiDocument.LoadAsync(originalOpenApiFile, "yaml");
var settings = new OpenApiReaderSettings();
settings.AddYamlReader();
var originalResult = await OpenApiDocument.LoadAsync(originalOpenApiFile, "yaml", settings);
var originalDocument = originalResult.Document;
Assert.Empty(originalResult.Diagnostic.Errors);

Expand All @@ -279,7 +283,7 @@ public async Task GeneratesManifestAndCleansUpInputDescriptionAsync()

// Validate the output open api file
using var resultOpenApiFile = File.OpenRead(Path.Combine(outputDirectory, OpenApiFileName));
var resultResult = await OpenApiDocument.LoadAsync(resultOpenApiFile, "yaml");
var resultResult = await OpenApiDocument.LoadAsync(resultOpenApiFile, "yaml", settings);
var resultDocument = resultResult.Document;
Assert.Empty(resultResult.Diagnostic.Errors);

Expand Down Expand Up @@ -794,7 +798,9 @@ public async Task MergesAllOfRequestBodyAsync(string content, Action<OpenApiDocu
{
// Validate the sliced openapi
using var stream = File.Open(Path.Combine(outputDirectory, OpenApiFileName), FileMode.Open);
var readResult = await OpenApiDocument.LoadAsync(stream);
var settings = new OpenApiReaderSettings();
settings.AddYamlReader();
var readResult = await OpenApiDocument.LoadAsync(stream, "yaml", settings);
assertions(readResult.Document, readResult.Diagnostic);
}
finally
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,7 @@ private static async Task<OpenApiDiagnostic> GetDiagnosticFromDocumentAsync(stri
using var stream = new MemoryStream(Encoding.UTF8.GetBytes(document));
var settings = new OpenApiReaderSettings();
settings.RuleSet.Add(typeof(OpenApiOperation), [rule]);
OpenApiReaderRegistry.RegisterReader(OpenApiConstants.Yaml, new OpenApiYamlReader());
OpenApiReaderRegistry.RegisterReader(OpenApiConstants.Yml, new OpenApiYamlReader());
settings.AddYamlReader();
var result = await OpenApiDocument.LoadAsync(stream, "yaml", settings);
return result.Diagnostic;
}
Expand Down
3 changes: 1 addition & 2 deletions tests/Kiota.Builder.Tests/Validation/GetWithBodyTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ private static async Task<OpenApiDiagnostic> GetDiagnosticFromDocumentAsync(stri
using var stream = new MemoryStream(Encoding.UTF8.GetBytes(document));
var settings = new OpenApiReaderSettings();
settings.RuleSet.Add(typeof(IOpenApiPathItem), [rule]);
OpenApiReaderRegistry.RegisterReader(OpenApiConstants.Yaml, new OpenApiYamlReader());
OpenApiReaderRegistry.RegisterReader(OpenApiConstants.Yml, new OpenApiYamlReader());
settings.AddYamlReader();
var result = await OpenApiDocument.LoadAsync(stream, "yaml", settings);
return result.Diagnostic;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@ private static async Task<OpenApiDiagnostic> GetDiagnosticFromDocumentAsync(stri
using var stream = new MemoryStream(Encoding.UTF8.GetBytes(document));
var settings = new OpenApiReaderSettings();
settings.RuleSet.Add(typeof(IOpenApiSchema), [rule]);
OpenApiReaderRegistry.RegisterReader(OpenApiConstants.Yaml, new OpenApiYamlReader());
OpenApiReaderRegistry.RegisterReader(OpenApiConstants.Yml, new OpenApiYamlReader());
settings.AddYamlReader();
var result = await OpenApiDocument.LoadAsync(stream, "yaml", settings);
return result.Diagnostic;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@ private static async Task<OpenApiDiagnostic> GetDiagnosticFromDocumentAsync(stri
using var stream = new MemoryStream(Encoding.UTF8.GetBytes(document));
var settings = new OpenApiReaderSettings();
settings.RuleSet.Add(typeof(IOpenApiSchema), [rule]);
OpenApiReaderRegistry.RegisterReader(OpenApiConstants.Yaml, new OpenApiYamlReader());
OpenApiReaderRegistry.RegisterReader(OpenApiConstants.Yml, new OpenApiYamlReader());
settings.AddYamlReader();
var result = await OpenApiDocument.LoadAsync(stream, "yaml", settings);
return result.Diagnostic;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,7 @@ private static async Task<OpenApiDiagnostic> GetDiagnosticFromDocumentAsync(stri
using var stream = new MemoryStream(Encoding.UTF8.GetBytes(document));
var settings = new OpenApiReaderSettings();
settings.RuleSet.Add(typeof(OpenApiDocument), [rule]);
OpenApiReaderRegistry.RegisterReader(OpenApiConstants.Yaml, new OpenApiYamlReader());
OpenApiReaderRegistry.RegisterReader(OpenApiConstants.Yml, new OpenApiYamlReader());
settings.AddYamlReader();
var result = await OpenApiDocument.LoadAsync(stream, "yaml", settings);
return result.Diagnostic;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ private static async Task<OpenApiDiagnostic> GetDiagnosticFromDocumentAsync(stri
using var stream = new MemoryStream(Encoding.UTF8.GetBytes(document));
var settings = new OpenApiReaderSettings();
settings.RuleSet.Add(typeof(OpenApiDocument), [rule]);
OpenApiReaderRegistry.RegisterReader(OpenApiConstants.Yaml, new OpenApiYamlReader());
OpenApiReaderRegistry.RegisterReader(OpenApiConstants.Yml, new OpenApiYamlReader());
settings.AddYamlReader();
var result = await OpenApiDocument.LoadAsync(stream, "yaml", settings);
return result.Diagnostic;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ private static async Task<OpenApiDiagnostic> GetDiagnosticFromDocumentAsync(stri
using var stream = new MemoryStream(Encoding.UTF8.GetBytes(document));
var settings = new OpenApiReaderSettings();
settings.RuleSet.Add(typeof(OpenApiOperation), [rule]);
OpenApiReaderRegistry.RegisterReader(OpenApiConstants.Yaml, new OpenApiYamlReader());
OpenApiReaderRegistry.RegisterReader(OpenApiConstants.Yml, new OpenApiYamlReader());
settings.AddYamlReader();
var result = await OpenApiDocument.LoadAsync(stream, "yaml", settings);
return result.Diagnostic;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ private static async Task<OpenApiDiagnostic> GetDiagnosticFromDocumentAsync(stri
using var stream = new MemoryStream(Encoding.UTF8.GetBytes(document));
var settings = new OpenApiReaderSettings();
settings.RuleSet.Add(typeof(OpenApiDocument), [rule]);
OpenApiReaderRegistry.RegisterReader(OpenApiConstants.Yaml, new OpenApiYamlReader());
OpenApiReaderRegistry.RegisterReader(OpenApiConstants.Yml, new OpenApiYamlReader());
settings.AddYamlReader();
var result = await OpenApiDocument.LoadAsync(stream, "yaml", settings);
return result.Diagnostic;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,7 @@ private static async Task<OpenApiDiagnostic> GetDiagnosticFromDocumentAsync(stri
using var stream = new MemoryStream(Encoding.UTF8.GetBytes(document));
var settings = new OpenApiReaderSettings();
settings.RuleSet.Add(typeof(OpenApiOperation), [rule]);
OpenApiReaderRegistry.RegisterReader(OpenApiConstants.Yaml, new OpenApiYamlReader());
OpenApiReaderRegistry.RegisterReader(OpenApiConstants.Yml, new OpenApiYamlReader());
settings.AddYamlReader();
var result = await OpenApiDocument.LoadAsync(stream, "yaml", settings);
return result.Diagnostic;
}
Expand Down
Loading