From cd6c27e8afe5c7b74af0e3f641a4e86f2d6a6237 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 5 Sep 2024 13:21:31 -0400 Subject: [PATCH] fix: map int types to number OAS type Signed-off-by: Vincent Biret --- src/Microsoft.OpenApi/Extensions/OpenApiTypeMapper.cs | 4 ++-- src/Microsoft.OpenApi/Validations/Rules/RuleHelpers.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Microsoft.OpenApi/Extensions/OpenApiTypeMapper.cs b/src/Microsoft.OpenApi/Extensions/OpenApiTypeMapper.cs index 03f42a3a0..be1737515 100644 --- a/src/Microsoft.OpenApi/Extensions/OpenApiTypeMapper.cs +++ b/src/Microsoft.OpenApi/Extensions/OpenApiTypeMapper.cs @@ -57,8 +57,8 @@ public static class OpenApiTypeMapper /// Other types including nullables and URL are also supported. /// Common Name type format Comments /// =========== ======= ====== ========================================= - /// integer integer int32 signed 32 bits - /// long integer int64 signed 64 bits + /// integer number int32 signed 32 bits + /// long number int64 signed 64 bits /// float number float /// double number double /// string string [empty] diff --git a/src/Microsoft.OpenApi/Validations/Rules/RuleHelpers.cs b/src/Microsoft.OpenApi/Validations/Rules/RuleHelpers.cs index 8052892da..33a978f10 100644 --- a/src/Microsoft.OpenApi/Validations/Rules/RuleHelpers.cs +++ b/src/Microsoft.OpenApi/Validations/Rules/RuleHelpers.cs @@ -196,7 +196,7 @@ public static void ValidateDataTypeMismatch( if (type == "number") { - if (value is not OpenApiDouble) + if (value is not OpenApiDouble or OpenApiInteger or OpenApiFloat or OpenApiLong) { context.CreateWarning( ruleName,