@@ -13,7 +13,6 @@ import Control.Applicative
13import Control.Monad
13import Control.Monad
14import Data.Aeson
14import Data.Aeson
15import Data.Aeson.TH (deriveJSON)
15import Data.Aeson.TH (deriveJSON)
16−import Data.Foldable (Foldable)
17import Data.HashMap.Strict (HashMap)
16import Data.HashMap.Strict (HashMap)
18import qualified Data.HashMap.Strict as HashMap
17import qualified Data.HashMap.Strict as HashMap
19import Data.Map (Map)
18import Data.Map (Map)
@@ -23,8 +22,6 @@ import Data.Scientific (Scientific)
23import Data.String (fromString)
22import Data.String (fromString)
24import Data.Text (Text)
23import Data.Text (Text)
25import qualified Data.Text as Text
24import qualified Data.Text as Text
26−import Data.Traversable (Traversable)
27−import Data.Hashable (Hashable)
28import GHC.Generics (Generic)
25import GHC.Generics (Generic)
29import Network (HostName, PortNumber)
26import Network (HostName, PortNumber)
30import Network.HTTP.Media (MediaType)
27import Network.HTTP.Media (MediaType)
@@ -897,17 +894,17 @@ instance FromJSON OAuth2Params where
897 parseJSON = genericParseJSONWithSub "flow" (jsonPrefix "oauth2")
894 parseJSON = genericParseJSONWithSub "flow" (jsonPrefix "oauth2")
899instance FromJSON SecuritySchemeType where
896instance FromJSON SecuritySchemeType where
900− parseJSON json@(Object o) = do
897+ parseJSON js@(Object o) = do
901 (t :: Text) <- o .: "type"
898 (t :: Text) <- o .: "type"
902 case t of
899 case t of
903 "basic" -> pure SecuritySchemeBasic
900 "basic" -> pure SecuritySchemeBasic
904− "apiKey" -> SecuritySchemeApiKey <$> parseJSON json
901+ "apiKey" -> SecuritySchemeApiKey <$> parseJSON js
905− "oauth2" -> SecuritySchemeOAuth2 <$> parseJSON json
902+ "oauth2" -> SecuritySchemeOAuth2 <$> parseJSON js
906 _ -> empty
903 _ -> empty
907 parseJSON _ = empty
904 parseJSON _ = empty
909instance FromJSON Swagger where
906instance FromJSON Swagger where
910− parseJSON json@(Object o) = do
907+ parseJSON js@(Object o) = do
911 (version :: Text) <- o .: "swagger"
908 (version :: Text) <- o .: "swagger"
912 when (version /= "2.0") empty
909 when (version /= "2.0") empty
913 (genericParseJSON (jsonPrefix "")
910 (genericParseJSON (jsonPrefix "")
@@ -919,7 +916,7 @@ instance FromJSON Swagger where
919 , "parameters" .= (mempty :: HashMap Text Parameter)
916 , "parameters" .= (mempty :: HashMap Text Parameter)
920 , "responses" .= (mempty :: HashMap Text Response)
917 , "responses" .= (mempty :: HashMap Text Response)
921 , "securityDefinitions" .= (mempty :: HashMap Text SecurityScheme)
918 , "securityDefinitions" .= (mempty :: HashMap Text SecurityScheme)
923 parseJSON _ = empty
920 parseJSON _ = empty
925instance FromJSON SecurityScheme where
922instance FromJSON SecurityScheme where
@@ -947,30 +944,30 @@ instance FromJSON Host where
947 parseJSON _ = empty
944 parseJSON _ = empty
949instance FromJSON Paths where
946instance FromJSON Paths where
950− parseJSON json = Paths <$> parseJSON json
947+ parseJSON js = Paths <$> parseJSON js
952instance FromJSON MimeList where
949instance FromJSON MimeList where
953− parseJSON json = (MimeList . map fromString) <$> parseJSON json
950+ parseJSON js = (MimeList . map fromString) <$> parseJSON js
955instance FromJSON Parameter where
952instance FromJSON Parameter where
956 parseJSON = genericParseJSONWithSub "schema" (jsonPrefix "parameter")
953 parseJSON = genericParseJSONWithSub "schema" (jsonPrefix "parameter")
958instance FromJSON ParameterSchema where
955instance FromJSON ParameterSchema where
959− parseJSON json@(Object o) = do
956+ parseJSON js@(Object o) = do
960 (i :: Text) <- o .: "in"
957 (i :: Text) <- o .: "in"
961 case i of
958 case i of
962 "body" -> do
959 "body" -> do
963 schema <- o .: "schema"
960 schema <- o .: "schema"
964 ParameterBody <$> parseJSON schema
961 ParameterBody <$> parseJSON schema
965− _ -> ParameterOther <$> parseJSON json
962+ _ -> ParameterOther <$> parseJSON js
966 parseJSON _ = empty
963 parseJSON _ = empty
968instance FromJSON ParameterOtherSchema where
965instance FromJSON ParameterOtherSchema where
969 parseJSON = genericParseJSONWithSub "common" (jsonPrefix "parameterOtherSchema")
966 parseJSON = genericParseJSONWithSub "common" (jsonPrefix "parameterOtherSchema")
971instance FromJSON SchemaItems where
968instance FromJSON SchemaItems where
972− parseJSON json@(Object _) = SchemaItemsObject <$> parseJSON json
969+ parseJSON js@(Object _) = SchemaItemsObject <$> parseJSON js
973− parseJSON json@(Array _) = SchemaItemsArray <$> parseJSON json
970+ parseJSON js@(Array _) = SchemaItemsArray <$> parseJSON js
974 parseJSON _ = empty
971 parseJSON _ = empty
976instance FromJSON Responses where
973instance FromJSON Responses where
@@ -980,8 +977,8 @@ instance FromJSON Responses where
980 parseJSON _ = empty
977 parseJSON _ = empty
982instance FromJSON Example where
979instance FromJSON Example where
983− parseJSON json = do
980+ parseJSON js = do
984− m <- parseJSON json
981+ m <- parseJSON js
985 pure $ Example (Map.mapKeys fromString m)
982 pure $ Example (Map.mapKeys fromString m)
987instance FromJSON Response where
984instance FromJSON Response where
@@ -1001,9 +998,9 @@ instance FromJSON Reference where
1001 parseJSON _ = empty
998 parseJSON _ = empty
1003instance FromJSON a => FromJSON (Referenced a) where
1000instance FromJSON a => FromJSON (Referenced a) where
1004− parseJSON json
1001+ parseJSON js
1005− = Ref <$> parseJSON json
1002+ = Ref <$> parseJSON js
1006− <|> Inline <$> parseJSON json
1003+ <|> Inline <$> parseJSON js
1008instance FromJSON Xml where
1005instance FromJSON Xml where
1009 parseJSON = genericParseJSON (jsonPrefix "xml")
1006 parseJSON = genericParseJSON (jsonPrefix "xml")