From 89831fe6eada396617c832f42baf3a0a122948ee Mon Sep 17 00:00:00 2001 From: Rodge Fu Date: Sun, 10 Sep 2023 10:33:17 +0800 Subject: [PATCH] support format of datetime, date, time and duration --- src/AutoRest.CSharp/Common/Output/Builders/BuilderHelpers.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/AutoRest.CSharp/Common/Output/Builders/BuilderHelpers.cs b/src/AutoRest.CSharp/Common/Output/Builders/BuilderHelpers.cs index 51db12201d1..6825be735b8 100644 --- a/src/AutoRest.CSharp/Common/Output/Builders/BuilderHelpers.cs +++ b/src/AutoRest.CSharp/Common/Output/Builders/BuilderHelpers.cs @@ -89,6 +89,11 @@ public static Constant ParseConstant(object? value, CSharpType type) _ => SerializationFormat.Duration_ISO8601 }, + _ when schema.Type == AllSchemaTypes.Duration => SerializationFormat.Duration_ISO8601, + _ when schema.Type == AllSchemaTypes.DateTime => SerializationFormat.DateTime_ISO8601, + _ when schema.Type == AllSchemaTypes.Date => SerializationFormat.DateTime_ISO8601, + _ when schema.Type == AllSchemaTypes.Time => SerializationFormat.DateTime_ISO8601, + _ => schema.Extensions?.Format switch { XMsFormat.DateTime => SerializationFormat.DateTime_ISO8601,