Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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: 4 additions & 0 deletions src/Core/Services/OpenAPI/JsonDataType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ public enum JsonDataType
/// </summary>
Boolean = 5,
/// <summary>
/// A JSON integer (subset of number without a fraction or exponent part)
/// </summary>
Integer = 7,
/// <summary>
/// The JSON value null
/// </summary>
Null = 6
Expand Down
16 changes: 8 additions & 8 deletions src/Core/Services/TypeHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ public static class TypeHelper
/// </summary>
private static Dictionary<Type, JsonDataType> _systemTypeToJsonDataTypeMap = new()
{
[typeof(byte)] = JsonDataType.String,
[typeof(sbyte)] = JsonDataType.String,
[typeof(short)] = JsonDataType.Number,
[typeof(ushort)] = JsonDataType.Number,
[typeof(int)] = JsonDataType.Number,
[typeof(uint)] = JsonDataType.Number,
[typeof(long)] = JsonDataType.Number,
[typeof(ulong)] = JsonDataType.Number,
[typeof(byte)] = JsonDataType.Integer,
[typeof(sbyte)] = JsonDataType.Integer,
[typeof(short)] = JsonDataType.Integer,
[typeof(ushort)] = JsonDataType.Integer,
[typeof(int)] = JsonDataType.Integer,
[typeof(uint)] = JsonDataType.Integer,
[typeof(long)] = JsonDataType.Integer,
[typeof(ulong)] = JsonDataType.Integer,
[typeof(float)] = JsonDataType.Number,
[typeof(double)] = JsonDataType.Number,
[typeof(decimal)] = JsonDataType.Number,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public async Task TestInputParametersForStoredProcedures()
Assert.IsTrue(operation.Parameters.Any(param =>
param.In is ParameterLocation.Query
&& param.Name.Equals("id")
&& param.Schema.Type.Equals("number")
&& param.Schema.Type.Equals("integer")
&& param.Required is false));

// Parameter with default value will be an optional query parameter.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public void ValidateRequestBodyContents(string entityName, string[] expectedPara
/// <param name="entityName">Entity to test, requires updating the CreateEntities() helper.</param>
/// <param name="expectedColumns">Expected first result set columns</param>
/// <param name="expectedColumnJsonTypes">Expected first result set column types (JSON)</param>
[DataRow("sp1", new string[] { "id", "title", "publisher_id" }, new string[] { "number", "string", "number" }, DisplayName = "Validate response body parameters and parameter Json data types.")]
[DataRow("sp1", new string[] { "id", "title", "publisher_id" }, new string[] { "integer", "string", "integer" }, DisplayName = "Validate response body parameters and parameter Json data types.")]
[DataTestMethod]
public void ValidateResponseBodyContents(string entityName, string[] expectedColumns, string[] expectedColumnJsonTypes)
{
Expand Down