Repository: microsoft/kiota (csharp)

Issue:
Handling of integer number types with `int16` format.
As a follow up to https://github.com/microsoft/OpenAPI.NET.OData/pull/593

The `integer` types were replaced in the openapi description with `number` types which presented the a inconsistency in the generation.  Due to the case at the line below. 

https://github.com/microsoft/kiota/blob/a14fb8130851192316238393e4958844069967b8/src/Kiota.Builder/KiotaBuilder.cs#L1159C19-L1159C26

Properties with the type as `integer` and format as `int16` would be projected as type `integer` in the codeDom. 

However changing the type to `integer` results in the type being projected as `double` as opposed to `integer` before as there is no case to handle the `integer` with `int16` format.

Pull request:
Closes https://github.com/microsoft/kiota/issues/5611

Generation run at https://dev.azure.com/microsoftgraph/Graph%20Developer%20Experiences/_build/results?buildId=167346&view=results

Sample diff at https://github.com/microsoftgraph/msgraph-sdk-dotnet/compare/kiota/v1.0/pipelinebuild/167322..kiota/v1.0/pipelinebuild/167346

Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 20d47e2440..23ea913175 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,6 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 
 ### Changed
 
+- Fixes mapping of `int16` format to the `integer` type rather than `double` when the type is `integer` or `number` [#5611](https://github.com/microsoft/kiota/issues/5611)
+
 ## [1.19.1] - 2024-10-11
 
 ### Added
@@ -23,7 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 - Fixed cyclic dependencies in generated Go code. [#2834](https://github.com/microsoft/kiota/issues/2834)
 - Fixed a bug where default output folder is created on plugin edit and generate commands. [#5510](https://github.com/microsoft/kiota/issues/5429)
 - Changed GeneratedCode attribute applied when generating CSharp to only include the major version of Kiota. [#5489](https://github.com/microsoft/kiota/issues/5489)
-- Fixed genarating CSharp client displays clean hint regardless of whether --clean-output is already passed [#5576](https://github.com/microsoft/kiota/issues/5576)
+- Fixed generating CSharp client displays clean hint regardless of whether --clean-output is already passed [#5576](https://github.com/microsoft/kiota/issues/5576)
 
 ## [1.19.0] - 2024-10-03
 
diff --git a/src/Kiota.Builder/KiotaBuilder.cs b/src/Kiota.Builder/KiotaBuilder.cs
index 8a1a4e69f2..4325507151 100644
--- a/src/Kiota.Builder/KiotaBuilder.cs
+++ b/src/Kiota.Builder/KiotaBuilder.cs
@@ -1154,6 +1154,7 @@ openApiExtension is OpenApiPrimaryErrorMessageExtension primaryErrorMessageExten
                 ("number" or "integer", "int8") => "sbyte",
                 ("number" or "integer", "uint8") => "byte",
                 ("number" or "integer", "int64") => "int64",
+                ("number", "int16") => "integer",
                 ("number", "int32") => "integer",
                 ("number", _) => "double",
                 ("integer", _) => "integer",


Test patch:
diff --git a/tests/Kiota.Builder.Tests/KiotaBuilderTests.cs b/tests/Kiota.Builder.Tests/KiotaBuilderTests.cs
index 7d7382168b..32123dcde3 100644
--- a/tests/Kiota.Builder.Tests/KiotaBuilderTests.cs
+++ b/tests/Kiota.Builder.Tests/KiotaBuilderTests.cs
@@ -4491,6 +4491,8 @@ public void InheritedTypeWithInlineSchemaWorks()
     [InlineData("integer", "int64", "int64")]
     [InlineData("number", "int8", "sbyte")]
     [InlineData("integer", "int8", "sbyte")]
+    [InlineData("number", "int16", "integer")]
+    [InlineData("integer", "int16", "integer")]
     [InlineData("number", "uint8", "byte")]
     [InlineData("integer", "uint8", "byte")]
     [InlineData("number", "", "double")]