git.iko.soy/typeable/swagger2
on master help sign in
Cleanup error case matching
9b6c745Matthias Fischmann
src/Data/Swagger/Internal/Schema/Validation.hs+2−3
@@ -484,7 +484,7 @@ validateSchemaType value = withSchema $ \sch ->
484 (Nothing, String s) -> sub_ paramSchema (validateString s)
484 (Nothing, String s) -> sub_ paramSchema (validateString s)
485 (Nothing, Array xs) -> sub_ paramSchema (validateArray xs)
485 (Nothing, Array xs) -> sub_ paramSchema (validateArray xs)
486 (Nothing, Object o) -> validateObject o
486 (Nothing, Object o) -> validateObject o
487− param@(t, _) -> invalid $ "expected JSON value of type " ++ showType param
487+ bad -> invalid $ "expected JSON value of type " ++ showType bad
488
488
489validateParamSchemaType :: Value -> Validation (ParamSchema t) ()
489validateParamSchemaType :: Value -> Validation (ParamSchema t) ()
490validateParamSchemaType value = withSchema $ \sch ->
490validateParamSchemaType value = withSchema $ \sch ->
@@ -499,8 +499,7 @@ validateParamSchemaType value = withSchema $ \sch ->
499 (Nothing, Number n) -> validateNumber n
499 (Nothing, Number n) -> validateNumber n
500 (Nothing, String s) -> validateString s
500 (Nothing, String s) -> validateString s
501 (Nothing, Array xs) -> validateArray xs
501 (Nothing, Array xs) -> validateArray xs
502− (t, _) -> invalid $ "expected JSON value of type " ++ show t
503− param@(t, _) -> invalid $ "expected JSON value of type " ++ showType param
502+ bad -> invalid $ "expected JSON value of type " ++ showType bad
504
503
505showType :: (Maybe (SwaggerType t), Value) -> String
504showType :: (Maybe (SwaggerType t), Value) -> String
506showType (Just type_, _) = show type_
505showType (Just type_, _) = show type_