@@ -1088,13 +1088,12 @@ instance OVERLAPPABLE_ FromJSON (SwaggerItems Schema) where
1088 parseJSON _ = empty
1088 parseJSON _ = empty
1090instance FromJSON Host where
1090instance FromJSON Host where
1091− parseJSON (String s) =
1091+ parseJSON (String s) = case map Text.unpack $ Text.split (== ':') s of
1092− case fromInteger <$> readMaybe portStr of
1092+ [host] -> return $ Host host Nothing
1093− Nothing | not (null portStr) -> fail $ "Invalid port `" ++ portStr ++ "'"
1093+ [host, port] -> case readMaybe port of
1094− mport -> pure $ Host host mport
1094+ Nothing -> fail $ "Invalid port `" ++ port ++ "'"
1095− where
1095+ Just p -> return $ Host host (Just (fromInteger p))
1096− (hostText, portText) = Text.breakOn ":" s
1096+ _ -> fail $ "Invalid host `" ++ Text.unpack s ++ "'"
1097− [host, portStr] = map Text.unpack [hostText, portText]
1098 parseJSON _ = empty
1097 parseJSON _ = empty
1100instance FromJSON MimeList where
1099instance FromJSON MimeList where