From 09b99af5a65beef186daaf57d2ed3a101e9b46eb Mon Sep 17 00:00:00 2001 From: MIkE <31508539+MichaelMay81@users.noreply.github.com> Date: Mon, 3 Jun 2024 20:24:54 +0200 Subject: [PATCH] Fix: Required DateTime QueryParameter in round-trip format (#245) * fix: DateTime and DateTimeOffset as query parameters with round-trip format * updated release notes --- docs/RELEASE_NOTES.md | 4 ++++ src/SwaggerProvider.Runtime/RuntimeHelpers.fs | 2 ++ 2 files changed, 6 insertions(+) diff --git a/docs/RELEASE_NOTES.md b/docs/RELEASE_NOTES.md index 7a101cd..69ed8ac 100644 --- a/docs/RELEASE_NOTES.md +++ b/docs/RELEASE_NOTES.md @@ -1,3 +1,7 @@ +#### 2.1.2 - Jun 3, 2024 + + - fix: Support DateTime/DateTimeOffset as required query parameter, using round-trip format (#244) + #### 2.1.1 - Apr 8, 2024 - Minor dependency updates diff --git a/src/SwaggerProvider.Runtime/RuntimeHelpers.fs b/src/SwaggerProvider.Runtime/RuntimeHelpers.fs index 07867b8..885ed8c 100644 --- a/src/SwaggerProvider.Runtime/RuntimeHelpers.fs +++ b/src/SwaggerProvider.Runtime/RuntimeHelpers.fs @@ -110,6 +110,8 @@ module RuntimeHelpers = | :? Option as x -> x |> toStrOpt name | :? Option as x -> x |> toStrDateTimeOpt name | :? Option as x -> x |> toStrDateTimeOffsetOpt name + | :? DateTime as x -> [ name, x.ToString("O") ] + | :? DateTimeOffset as x -> [ name, x.ToString("O") ] | :? Option as x -> x |> toStrOpt name | _ -> [ name, (if isNull obj then null else obj.ToString()) ]