Skip to content
Open
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
5 changes: 3 additions & 2 deletions src/NSwag.CodeGeneration/Models/ParameterModelBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ public IEnumerable<PropertyModel> CollectionPropertyNames

/// <summary>Gets a value indicating whether the parameter is of type date-time</summary>
public bool IsDateTime =>
Schema.Format == JsonFormatStrings.DateTime && _generator.GetTypeName(Schema, IsNullable, null) != "string";
Schema.Format is JsonFormatStrings.DateTime or JsonFormatStrings.TimeSpan &&
_generator.GetTypeName(Schema, IsNullable, null) != "string";

/// <summary>Gets a value indicating whether the parameter is of type date-time or date</summary>
public bool IsDateOrDateTime => IsDate || IsDateTime;
Expand All @@ -182,7 +183,7 @@ public IEnumerable<PropertyModel> CollectionPropertyNames
/// <summary>Gets a value indicating whether the parameter is of type date-time array.</summary>
public bool IsDateTimeArray =>
IsArray &&
Schema.Item?.ActualSchema.Format == JsonFormatStrings.DateTime &&
Schema.Item?.ActualSchema.Format is JsonFormatStrings.DateTime or JsonFormatStrings.TimeSpan &&
_generator.GetTypeName(Schema.Item.ActualSchema, IsNullable, null) != "string";

/// <summary>Gets a value indicating whether the parameter is of type date-time or date array.</summary>
Expand Down