git.iko.soy/typeable/openapi3
on master help sign in
Fix FromJSON SwaggerHost instance
9a9110cNickolay Kudasov
src/Data/Swagger/Internal.hs+2−2
@@ -936,10 +936,10 @@ instance FromJSON SwaggerItems where
936instance FromJSON SwaggerHost where
936instance FromJSON SwaggerHost where
937 parseJSON (String s) =
937 parseJSON (String s) =
938 case fromInteger <$> readMaybe portStr of
938 case fromInteger <$> readMaybe portStr of
939− Nothing | not (null portStr) -> empty
939+ Nothing | not (null portStr) -> fail $ "Invalid port `" ++ portStr ++ "'"
940 mport -> pure $ SwaggerHost host mport
940 mport -> pure $ SwaggerHost host mport
941 where
941 where
942− (hostText, portText) = Text.breakOnEnd ":" s
942+ (hostText, portText) = Text.breakOn ":" s
943 [host, portStr] = map Text.unpack [hostText, portText]
943 [host, portStr] = map Text.unpack [hostText, portText]
944 parseJSON _ = empty
944 parseJSON _ = empty
945
945