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 22, 2019
1 parent 4148393 commit 9b6c745
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 @@ -484,7 +484,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 @@ -499,8 +499,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 9b6c745

Please sign in to comment.