From d5c3619e25c7707fc73f4d907f64cdf9fc392fc0 Mon Sep 17 00:00:00 2001 From: maliming Date: Thu, 26 Oct 2023 15:00:36 +0800 Subject: [PATCH 1/2] Support `DateOnly` and `TimeOnly` in `AspNetCoreApiDescriptionModelProvider`. --- .../Mvc/AspNetCoreApiDescriptionModelProvider.cs | 2 ++ .../src/Volo.Abp.Core/Volo/Abp/Reflection/TypeHelper.cs | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AspNetCoreApiDescriptionModelProvider.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AspNetCoreApiDescriptionModelProvider.cs index f1d014b76a..0a10835e3c 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AspNetCoreApiDescriptionModelProvider.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AspNetCoreApiDescriptionModelProvider.cs @@ -214,6 +214,8 @@ public class AspNetCoreApiDescriptionModelProvider : IApiDescriptionModelProvide type == typeof(void) || type == typeof(Enum) || type == typeof(ValueType) || + type == typeof(DateOnly) || + type == typeof(TimeOnly) || TypeHelper.IsPrimitiveExtended(type)) { return; diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/Reflection/TypeHelper.cs b/framework/src/Volo.Abp.Core/Volo/Abp/Reflection/TypeHelper.cs index b439a5a07b..1efa6c4f29 100644 --- a/framework/src/Volo.Abp.Core/Volo/Abp/Reflection/TypeHelper.cs +++ b/framework/src/Volo.Abp.Core/Volo/Abp/Reflection/TypeHelper.cs @@ -257,6 +257,14 @@ public static class TypeHelper { return "string"; } + else if (type.FullName == "System.DateOnly") + { + return "string"; + } + else if (type.FullName == "System.TimeOnly") + { + return "string"; + } else if (type == typeof(TimeSpan)) { return "string"; From 1c3054454c74188ed1344407a755208740cbb5d9 Mon Sep 17 00:00:00 2001 From: masumulu28 Date: Thu, 26 Oct 2023 12:07:36 +0300 Subject: [PATCH 2/2] Add mapping for DateOnly & TimeOnly structs --- npm/ng-packs/packages/schematics/src/constants/system-types.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/npm/ng-packs/packages/schematics/src/constants/system-types.ts b/npm/ng-packs/packages/schematics/src/constants/system-types.ts index 19a8eee259..d64c36d1b8 100644 --- a/npm/ng-packs/packages/schematics/src/constants/system-types.ts +++ b/npm/ng-packs/packages/schematics/src/constants/system-types.ts @@ -5,6 +5,8 @@ export const SYSTEM_TYPES = new Map([ ['Collections.Generic.Dictionary', 'Record'], ['DateTime', 'string'], ['DateTimeOffset', 'string'], + ['DateOnly', 'string'], + ['TimeOnly', 'string'], ['Decimal', 'number'], ['Double', 'number'], ['Guid', 'string'],