Browse Source

Merge pull request #17981 from abpframework/DateOnly

Support `DateOnly` and `TimeOnly` in `AspNetCoreApiDescriptionModelProvider`.
pull/17993/head
Masum ULU 2 years ago
committed by GitHub
parent
commit
29676a4f8d
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AspNetCoreApiDescriptionModelProvider.cs
  2. 8
      framework/src/Volo.Abp.Core/Volo/Abp/Reflection/TypeHelper.cs
  3. 2
      npm/ng-packs/packages/schematics/src/constants/system-types.ts

2
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;

8
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";

2
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'],

Loading…
Cancel
Save