Skip to content

Commit c0151a8

Browse files
Update to Microsoft.OpenApi for .NET 11
For .NET 11 (so far), target Microsoft.OpenApi 3.4.0.
1 parent 7a72afa commit c0151a8

23 files changed

Lines changed: 175 additions & 27 deletions

File tree

Directory.Packages.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
<PackageVersion Include="Microsoft.CodeAnalysis.PublicApiAnalyzers" Version="4.14.0" />
1818
<PackageVersion Include="Microsoft.EntityFrameworkCore.InMemory" Version="11.0.0-preview.2.26159.112" />
1919
<PackageVersion Include="Microsoft.Kiota.Bundle" Version="1.22.0" />
20-
<PackageVersion Include="Microsoft.OpenApi" Version="2.7.0" />
21-
<PackageVersion Include="Microsoft.OpenApi.YamlReader" Version="2.7.0" />
20+
<PackageVersion Include="Microsoft.OpenApi" Version="3.4.0" />
21+
<PackageVersion Include="Microsoft.OpenApi.YamlReader" Version="3.4.0" />
2222
<PackageVersion Include="Microsoft.Playwright" Version="1.58.0" />
2323
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.3.0" />
2424
<PackageVersion Include="MSBuild.ProjectCreation" Version="17.0.1" />

perf/Swashbuckle.AspNetCore.Benchmarks/XmlCommentsBenchmark.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,11 @@ public void Setup()
115115
// Request Body
116116
_requestBody = new OpenApiRequestBody
117117
{
118-
Content = new Dictionary<string, OpenApiMediaType>()
118+
#if NET11_0_OR_GREATER
119+
Content = new Dictionary<string, IOpenApiMediaType>
120+
#else
121+
Content = new Dictionary<string, OpenApiMediaType>
122+
#endif
119123
{
120124
["application/json"] = new OpenApiMediaType()
121125
{

src/Swashbuckle.AspNetCore.Annotations/AnnotationsOperationFilter.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,11 @@ private static void ApplySwaggerResponseAttributes(
117117
swaggerResponseAttribute.ContentTypes is { } contentTypes)
118118
{
119119
concrete.Content?.Clear();
120+
#if NET11_0_OR_GREATER
121+
concrete.Content ??= new Dictionary<string, IOpenApiMediaType>();
122+
#else
120123
concrete.Content ??= new Dictionary<string, OpenApiMediaType>();
124+
#endif
121125

122126
foreach (var contentType in contentTypes)
123127
{

src/Swashbuckle.AspNetCore.ApiTesting/IContentValidator.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
using Microsoft.OpenApi;
22

3+
#if NET11_0_OR_GREATER
4+
using OpenApiMediaType = Microsoft.OpenApi.IOpenApiMediaType;
5+
#endif
6+
37
namespace Swashbuckle.AspNetCore.ApiTesting;
48

59
public interface IContentValidator

src/Swashbuckle.AspNetCore.ApiTesting/JsonContentValidator.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
using Microsoft.OpenApi;
22
using Newtonsoft.Json.Linq;
33

4+
#if NET11_0_OR_GREATER
5+
using OpenApiMediaType = Microsoft.OpenApi.IOpenApiMediaType;
6+
#endif
7+
48
namespace Swashbuckle.AspNetCore.ApiTesting;
59

610
public sealed class JsonContentValidator : IContentValidator

src/Swashbuckle.AspNetCore.ApiTesting/PublicAPI/PublicAPI.Shipped.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ Swashbuckle.AspNetCore.ApiTesting.ContentDoesNotMatchSpecException.ContentDoesNo
2121
Swashbuckle.AspNetCore.ApiTesting.HttpHeadersExtensions
2222
Swashbuckle.AspNetCore.ApiTesting.IContentValidator
2323
Swashbuckle.AspNetCore.ApiTesting.IContentValidator.CanValidate(string mediaType) -> bool
24-
Swashbuckle.AspNetCore.ApiTesting.IContentValidator.Validate(Microsoft.OpenApi.OpenApiMediaType mediaTypeSpec, Microsoft.OpenApi.OpenApiDocument openApiDocument, System.Net.Http.HttpContent content) -> void
2524
Swashbuckle.AspNetCore.ApiTesting.IJsonValidator
2625
Swashbuckle.AspNetCore.ApiTesting.IJsonValidator.CanValidate(Microsoft.OpenApi.IOpenApiSchema schema) -> bool
2726
Swashbuckle.AspNetCore.ApiTesting.IJsonValidator.Validate(Microsoft.OpenApi.IOpenApiSchema schema, Microsoft.OpenApi.OpenApiDocument openApiDocument, Newtonsoft.Json.Linq.JToken instance, out System.Collections.Generic.IEnumerable<string> errorMessages) -> bool
@@ -44,7 +43,6 @@ Swashbuckle.AspNetCore.ApiTesting.JsonBooleanValidator.Validate(Microsoft.OpenAp
4443
Swashbuckle.AspNetCore.ApiTesting.JsonContentValidator
4544
Swashbuckle.AspNetCore.ApiTesting.JsonContentValidator.CanValidate(string mediaType) -> bool
4645
Swashbuckle.AspNetCore.ApiTesting.JsonContentValidator.JsonContentValidator() -> void
47-
Swashbuckle.AspNetCore.ApiTesting.JsonContentValidator.Validate(Microsoft.OpenApi.OpenApiMediaType mediaTypeSpec, Microsoft.OpenApi.OpenApiDocument openApiDocument, System.Net.Http.HttpContent content) -> void
4846
Swashbuckle.AspNetCore.ApiTesting.JsonNullValidator
4947
Swashbuckle.AspNetCore.ApiTesting.JsonNullValidator.CanValidate(Microsoft.OpenApi.IOpenApiSchema schema) -> bool
5048
Swashbuckle.AspNetCore.ApiTesting.JsonNullValidator.JsonNullValidator() -> void
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Swashbuckle.AspNetCore.ApiTesting.IContentValidator.Validate(Microsoft.OpenApi.OpenApiMediaType mediaTypeSpec, Microsoft.OpenApi.OpenApiDocument openApiDocument, System.Net.Http.HttpContent content) -> void
2+
Swashbuckle.AspNetCore.ApiTesting.JsonContentValidator.Validate(Microsoft.OpenApi.OpenApiMediaType mediaTypeSpec, Microsoft.OpenApi.OpenApiDocument openApiDocument, System.Net.Http.HttpContent content) -> void
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Swashbuckle.AspNetCore.ApiTesting.IContentValidator.Validate(Microsoft.OpenApi.IOpenApiMediaType mediaTypeSpec, Microsoft.OpenApi.OpenApiDocument openApiDocument, System.Net.Http.HttpContent content) -> void
2+
Swashbuckle.AspNetCore.ApiTesting.JsonContentValidator.Validate(Microsoft.OpenApi.IOpenApiMediaType mediaTypeSpec, Microsoft.OpenApi.OpenApiDocument openApiDocument, System.Net.Http.HttpContent content) -> void

0 commit comments

Comments
 (0)