@@ -1,3 +1,4 @@
1+{-# LANGUAGE CPP #-}
12{-# LANGUAGE DataKinds #-}
23{-# LANGUAGE DeriveDataTypeable #-}
34{-# LANGUAGE DeriveGeneric #-}
@@ -21,6 +22,9 @@ import Prelude.Compat
2122import Control.Applicative
2223import Control.Lens ((&), (.~), (?~))
2324import Data.Aeson hiding (Encoding)
25+#if MIN_VERSION_aeson(2,0,0)
26+import qualified Data.Aeson.KeyMap as KeyMap
27+#endif
2428import qualified Data.Aeson.Types as JSON
2529import Data.Data (Constr, Data (..), DataType, Fixity (..), Typeable,
2630 constrIndex, mkConstr, mkDataType)
@@ -45,17 +49,13 @@ import Text.Read (readMaybe)
4549import Data.HashMap.Strict.InsOrd (InsOrdHashMap)
4650import qualified Data.HashMap.Strict.InsOrd as InsOrdHashMap
4751
48−import Generics.SOP.TH (deriveGeneric)
49−import Data.OpenApi.Internal.AesonUtils (sopSwaggerGenericToEncoding
50− ,sopSwaggerGenericToJSON
51− ,sopSwaggerGenericToJSONWithOpts
52− ,sopSwaggerGenericParseJSON
53− ,HasSwaggerAesonOptions(..)
54− ,AesonDefaultValue(..)
55− ,mkSwaggerAesonOptions
56− ,saoAdditionalPairs
57− ,saoSubObject)
52+import Data.OpenApi.Aeson.Compat (deleteKey)
53+import Data.OpenApi.Internal.AesonUtils (AesonDefaultValue (..), HasSwaggerAesonOptions (..),
54+ mkSwaggerAesonOptions, saoAdditionalPairs, saoSubObject,
55+ sopSwaggerGenericParseJSON, sopSwaggerGenericToEncoding,
56+ sopSwaggerGenericToJSON, sopSwaggerGenericToJSONWithOpts)
5857import Data.OpenApi.Internal.Utils
58+import Generics.SOP.TH (deriveGeneric)
5959
6060-- $setup
6161-- >>> :seti -XDataKinds
@@ -337,7 +337,7 @@ data RequestBody = RequestBody
337337 -- | The content of the request body.
338338 -- The key is a media type or media type range and the value describes it.
339339 -- For requests that match multiple keys, only the most specific key is applicable.
340− -- e.g. @text/plain@ overrides @text/*@
340+ -- e.g. @text/plain@ overrides @text/\*@
341341 , _requestBodyContent :: InsOrdHashMap MediaType MediaTypeObject
342342
343343 -- | Determines if the request body is required in the request.
@@ -394,7 +394,7 @@ data Encoding = Encoding
394394 -- for other primitive types – @text/plain@; for object - @application/json@;
395395 -- for array – the default is defined based on the inner type.
396396 -- The value can be a specific media type (e.g. @application/json@),
397− -- a wildcard media type (e.g. @image/*@), or a comma-separated list of the two types.
397+ -- a wildcard media type (e.g. @image/\*@), or a comma-separated list of the two types.
398398 _encodingContentType :: Maybe MediaType
399399
400400 -- | A map allowing additional information to be provided as headers,
@@ -734,7 +734,7 @@ data Response = Response
734734 -- | A map containing descriptions of potential response payloads.
735735 -- The key is a media type or media type range and the value describes it.
736736 -- For responses that match multiple keys, only the most specific key is applicable.
737− -- e.g. @text/plain@ overrides @text/*@.
737+ -- e.g. @text/plain@ overrides @text/\*@.
738738 , _responseContent :: InsOrdHashMap MediaType MediaTypeObject
739739
740740 -- | Maps a header name to its definition.
@@ -1492,7 +1492,7 @@ instance FromJSON Param where
14921492instance FromJSON Responses where
14931493 parseJSON (Object o) = Responses
14941494 <$> o .:? "default"
1495− <*> parseJSON (Object (HashMap.delete "default" o))
1495+ <*> parseJSON (Object (deleteKey "default" o))
14961496 parseJSON _ = empty
14971497
14981498instance FromJSON Example where