Use date-time format for ZonedTime (#20)
Previously ToParamSchema ZonedTime instance used custom format instead
of OpenAPI default "date-time".
Partially fixes #16.
commit1357ab9ffcc1dd264d79bcf8a8fc7dcac0998a50
authorMaxim Koltsov <kolmax94@gmail.com>
dateSat 17 Apr 2021, 16:58 (5 years ago)
parente6597e6
src/Data/OpenApi/Internal/ParamSchema.hs+2−2
@@ -216,9 +216,9 @@ instance ToParamSchema LocalTime where
216216
217217-- |
218218-- >>> toParamSchema (Proxy :: Proxy ZonedTime) ^. format
219−-- Just "yyyy-mm-ddThh:MM:ss+hhMM"
219+-- Just "date-time"
220220instance ToParamSchema ZonedTime where
221− toParamSchema _ = timeParamSchema "yyyy-mm-ddThh:MM:ss+hhMM"
221+ toParamSchema _ = timeParamSchema "date-time"
222222
223223-- |
224224-- >>> toParamSchema (Proxy :: Proxy UTCTime) ^. format
src/Data/OpenApi/Internal/Schema.hs+1−1
@@ -657,7 +657,7 @@ instance ToSchema LocalTime where
657657 declareNamedSchema _ = pure $ named "LocalTime" $ timeSchema "yyyy-mm-ddThh:MM:ss"
658658 & example ?~ toJSON (LocalTime (fromGregorian 2016 7 22) (TimeOfDay 7 40 0))
659659
660−-- | Format @"date"@ corresponds to @yyyy-mm-ddThh:MM:ss(Z|+hh:MM)@ format.
660+-- | Format @"date-time"@ corresponds to @yyyy-mm-ddThh:MM:ss(Z|+hh:MM)@ format.
661661instance ToSchema ZonedTime where
662662 declareNamedSchema _ = pure $ named "ZonedTime" $ timeSchema "date-time"
663663 & example ?~ toJSON (ZonedTime (LocalTime (fromGregorian 2016 7 22) (TimeOfDay 7 40 0)) (hoursToTimeZone 3))