Skip to content

Commit

Permalink
Cleanup error case matching
Browse files Browse the repository at this point in the history
  • Loading branch information
fisx committed Oct 11, 2019
1 parent f3edb48 commit bc2c37e
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/Data/Swagger/Internal/Schema/Validation.hs
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ validateSchemaType value = withSchema $ \sch ->
(Nothing, String s) -> sub_ paramSchema (validateString s)
(Nothing, Array xs) -> sub_ paramSchema (validateArray xs)
(Nothing, Object o) -> validateObject o
param@(t, _) -> invalid $ "expected JSON value of type " ++ showType param
bad -> invalid $ "expected JSON value of type " ++ showType bad

validateParamSchemaType :: Value -> Validation (ParamSchema t) ()
validateParamSchemaType value = withSchema $ \sch ->
Expand All @@ -413,8 +413,7 @@ validateParamSchemaType value = withSchema $ \sch ->
(Nothing, Number n) -> validateNumber n
(Nothing, String s) -> validateString s
(Nothing, Array xs) -> validateArray xs
(t, _) -> invalid $ "expected JSON value of type " ++ show t
param@(t, _) -> invalid $ "expected JSON value of type " ++ showType param
bad -> invalid $ "expected JSON value of type " ++ showType bad

showType :: (Maybe (SwaggerType t), Value) -> String
showType (Just type_, _) = show type_
Expand Down

0 comments on commit bc2c37e

Please sign in to comment.