@@ -128,7 +128,7 @@ declareSchema = fmap snd . declareNamedSchema
128-- (Nothing,"{\"type\":\"string\"}")
128-- (Nothing,"{\"type\":\"string\"}")
130-- >>> encode <$> toNamedSchema (Proxy :: Proxy Day)
130-- >>> encode <$> toNamedSchema (Proxy :: Proxy Day)
131−-- (Just "Day","{\"format\":\"yyyy-mm-dd\",\"type\":\"string\"}")
131+-- (Just "Day","{\"format\":\"date\",\"type\":\"string\"}")
132toNamedSchema :: ToSchema a => proxy a -> NamedSchema
132toNamedSchema :: ToSchema a => proxy a -> NamedSchema
133toNamedSchema = undeclare . declareNamedSchema
133toNamedSchema = undeclare . declareNamedSchema
@@ -228,7 +228,7 @@ inlineAllSchemas = inlineSchemasWhen (const True)
228-- | Convert a type into a schema without references.
228-- | Convert a type into a schema without references.
230-- >>> encode $ toInlinedSchema (Proxy :: Proxy [Day])
230-- >>> encode $ toInlinedSchema (Proxy :: Proxy [Day])
231−-- "{\"items\":{\"format\":\"yyyy-mm-dd\",\"type\":\"string\"},\"type\":\"array\"}"
231+-- "{\"items\":{\"format\":\"date\",\"type\":\"string\"},\"type\":\"array\"}"
233-- __WARNING:__ @'toInlinedSchema'@ will produce infinite schema
233-- __WARNING:__ @'toInlinedSchema'@ will produce infinite schema
234-- when inlining recursive schemas.
234-- when inlining recursive schemas.
@@ -305,11 +305,9 @@ timeSchema format = mempty
305 & schemaType .~ SwaggerString
305 & schemaType .~ SwaggerString
306 & schemaFormat ?~ format
306 & schemaFormat ?~ format
308−-- |
308+-- | Format @"date"@ corresponds to @yyyy-mm-dd@ format.
309−-- >>> toSchema (Proxy :: Proxy Day) ^. schemaFormat
311instance ToSchema Day where
309instance ToSchema Day where
312− declareNamedSchema _ = pure $ named "Day" (timeSchema "yyyy-mm-dd")
310+ declareNamedSchema _ = pure $ named "Day" (timeSchema "date")
315-- >>> toSchema (Proxy :: Proxy LocalTime) ^. schemaFormat
313-- >>> toSchema (Proxy :: Proxy LocalTime) ^. schemaFormat
@@ -317,11 +315,9 @@ instance ToSchema Day where
317instance ToSchema LocalTime where
315instance ToSchema LocalTime where
318 declareNamedSchema _ = pure $ named "LocalTime" (timeSchema "yyyy-mm-ddThh:MM:ss")
316 declareNamedSchema _ = pure $ named "LocalTime" (timeSchema "yyyy-mm-ddThh:MM:ss")
321−-- >>> toSchema (Proxy :: Proxy ZonedTime) ^. schemaFormat
322−-- Just "yyyy-mm-ddThh:MM:ss(Z|+hh:MM)"
318+-- | Format @"date"@ corresponds to @yyyy-mm-ddThh:MM:ss(Z|+hh:MM)@ format.
323instance ToSchema ZonedTime where
319instance ToSchema ZonedTime where
324− declareNamedSchema _ = pure $ named "ZonedTime" $ timeSchema "yyyy-mm-ddThh:MM:ss(Z|+hh:MM)"
320+ declareNamedSchema _ = pure $ named "ZonedTime" $ timeSchema "date-time"
326instance ToSchema NominalDiffTime where
322instance ToSchema NominalDiffTime where
327 declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy Integer)
323 declareNamedSchema _ = declareNamedSchema (Proxy :: Proxy Integer)