From ab886ef812744b0e2247346ef27292c05f647654 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 9 Oct 2024 21:12:13 +0000 Subject: [PATCH 01/12] Bump Microsoft.Extensions.Logging.Console from 8.0.0 to 8.0.1 Bumps [Microsoft.Extensions.Logging.Console](https://github.com/dotnet/runtime) from 8.0.0 to 8.0.1. - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](https://github.com/dotnet/runtime/compare/v8.0.0...v8.0.1) --- updated-dependencies: - dependency-name: Microsoft.Extensions.Logging.Console dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 54d3c612f..cab2dcf85 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -31,7 +31,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive From 90b51e50da529f8dcb99ce02d5cb3069393ff405 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 10 Oct 2024 07:22:22 +0000 Subject: [PATCH 02/12] Bump Microsoft.Extensions.Logging.Debug from 8.0.0 to 8.0.1 Bumps [Microsoft.Extensions.Logging.Debug](https://github.com/dotnet/runtime) from 8.0.0 to 8.0.1. - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](https://github.com/dotnet/runtime/compare/v8.0.0...v8.0.1) --- updated-dependencies: - dependency-name: Microsoft.Extensions.Logging.Debug dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index cab2dcf85..7e65e7f7c 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -32,7 +32,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all From dbf9beb8fc4e4ae58a4c03589abd1b9946bf1a40 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 10 Oct 2024 21:36:05 +0000 Subject: [PATCH 03/12] Bump Microsoft.OpenApi.OData from 2.0.0-preview.3 to 2.0.0-preview.4 Bumps [Microsoft.OpenApi.OData](https://github.com/Microsoft/OpenAPI.NET.OData) from 2.0.0-preview.3 to 2.0.0-preview.4. - [Release notes](https://github.com/Microsoft/OpenAPI.NET.OData/releases) - [Commits](https://github.com/Microsoft/OpenAPI.NET.OData/commits) --- updated-dependencies: - dependency-name: Microsoft.OpenApi.OData dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 7e65e7f7c..550f483d6 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -39,7 +39,7 @@ - + @@ -39,7 +39,7 @@ - + From c08c3b6dae0f39d27043d2c61ca2ae9038c23927 Mon Sep 17 00:00:00 2001 From: Weihan Li <7604648+WeihanLi@users.noreply.github.com> Date: Wed, 23 Oct 2024 07:47:53 +0800 Subject: [PATCH 11/12] use nameof for CallerArgumentExpression --- src/Microsoft.OpenApi/Utils.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi/Utils.cs b/src/Microsoft.OpenApi/Utils.cs index 10d5595f8..b025af8e7 100644 --- a/src/Microsoft.OpenApi/Utils.cs +++ b/src/Microsoft.OpenApi/Utils.cs @@ -20,7 +20,7 @@ internal static class Utils /// The input value. internal static T CheckArgumentNull( T value, - [CallerArgumentExpression("value")] string parameterName = "") + [CallerArgumentExpression(nameof(value))] string parameterName = "") { return value ?? throw new ArgumentNullException(parameterName, $"Value cannot be null: {parameterName}"); } From fe13c562a864efe93feb7c5055da1cb2999a750b Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 24 Oct 2024 13:11:13 -0400 Subject: [PATCH 12/12] fix: adds missing type mappings tests --- .../Extensions/OpenApiTypeMapper.cs | 4 ++-- .../Extensions/OpenApiTypeMapperTests.cs | 13 ++++++++++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/Microsoft.OpenApi/Extensions/OpenApiTypeMapper.cs b/src/Microsoft.OpenApi/Extensions/OpenApiTypeMapper.cs index 44380f934..c2839cb4d 100644 --- a/src/Microsoft.OpenApi/Extensions/OpenApiTypeMapper.cs +++ b/src/Microsoft.OpenApi/Extensions/OpenApiTypeMapper.cs @@ -101,7 +101,7 @@ public static Type MapOpenApiPrimitiveTypeToSimpleType(this OpenApiSchema schema // integer is technically not valid with format, but we must provide some compatibility ("integer" or "number", "int32", false) => typeof(int), ("integer" or "number", "int64", false) => typeof(long), - ("integer", null, false) => typeof(int), + ("integer", null, false) => typeof(long), ("number", "float", false) => typeof(float), ("number", "double", false) => typeof(double), ("number", "decimal", false) => typeof(decimal), @@ -116,7 +116,7 @@ public static Type MapOpenApiPrimitiveTypeToSimpleType(this OpenApiSchema schema ("string", "uri", false) => typeof(Uri), ("integer" or "number", "int32", true) => typeof(int?), ("integer" or "number", "int64", true) => typeof(long?), - ("integer", null, true) => typeof(int?), + ("integer", null, true) => typeof(long?), ("number", "float", true) => typeof(float?), ("number", "double", true) => typeof(double?), ("number", null, true) => typeof(double?), diff --git a/test/Microsoft.OpenApi.Tests/Extensions/OpenApiTypeMapperTests.cs b/test/Microsoft.OpenApi.Tests/Extensions/OpenApiTypeMapperTests.cs index 195e54b20..7326351da 100644 --- a/test/Microsoft.OpenApi.Tests/Extensions/OpenApiTypeMapperTests.cs +++ b/test/Microsoft.OpenApi.Tests/Extensions/OpenApiTypeMapperTests.cs @@ -16,10 +16,13 @@ public class OpenApiTypeMapperTests { new object[] { typeof(int), new OpenApiSchema { Type = "number", Format = "int32" } }, new object[] { typeof(decimal), new OpenApiSchema { Type = "number", Format = "double" } }, + new object[] { typeof(decimal?), new OpenApiSchema { Type = "number", Format = "double", Nullable = true } }, new object[] { typeof(bool?), new OpenApiSchema { Type = "boolean", Nullable = true } }, new object[] { typeof(Guid), new OpenApiSchema { Type = "string", Format = "uuid" } }, + new object[] { typeof(Guid?), new OpenApiSchema { Type = "string", Format = "uuid", Nullable = true } }, new object[] { typeof(uint), new OpenApiSchema { Type = "number", Format = "int32" } }, new object[] { typeof(long), new OpenApiSchema { Type = "number", Format = "int64" } }, + new object[] { typeof(long?), new OpenApiSchema { Type = "number", Format = "int64", Nullable = true } }, new object[] { typeof(ulong), new OpenApiSchema { Type = "number", Format = "int64" } }, new object[] { typeof(string), new OpenApiSchema { Type = "string" } }, new object[] { typeof(double), new OpenApiSchema { Type = "number", Format = "double" } }, @@ -35,11 +38,15 @@ public class OpenApiTypeMapperTests public static IEnumerable OpenApiDataTypes => new List { - new object[] { new OpenApiSchema { Type = "number", Format = "int32"}, typeof(int) }, + new object[] { new OpenApiSchema { Type = "number", Format = "int32", Nullable = false}, typeof(int) }, + new object[] { new OpenApiSchema { Type = "number", Format = "int32", Nullable = true}, typeof(int?) }, + new object[] { new OpenApiSchema { Type = "number", Format = "int64", Nullable = false}, typeof(long) }, + new object[] { new OpenApiSchema { Type = "number", Format = "int64", Nullable = true}, typeof(long?) }, new object[] { new OpenApiSchema { Type = "number", Format = "decimal"}, typeof(decimal) }, + new object[] { new OpenApiSchema { Type = "integer", Format = null, Nullable = false}, typeof(long) }, + new object[] { new OpenApiSchema { Type = "integer", Format = null, Nullable = true}, typeof(long?) }, new object[] { new OpenApiSchema { Type = "number", Format = null, Nullable = false}, typeof(double) }, - new object[] { new OpenApiSchema { Type = "number", Format = null, Nullable = false}, typeof(int) }, - new object[] { new OpenApiSchema { Type = "number", Format = null, Nullable = true}, typeof(int?) }, + new object[] { new OpenApiSchema { Type = "number", Format = null, Nullable = true}, typeof(double?) }, new object[] { new OpenApiSchema { Type = "number", Format = "decimal", Nullable = true}, typeof(decimal?) }, new object[] { new OpenApiSchema { Type = "number", Format = "double", Nullable = true}, typeof(double?) }, new object[] { new OpenApiSchema { Type = "string", Format = "date-time", Nullable = true}, typeof(DateTimeOffset?) },