git.iko.soy/typeable/swagger2
on master help sign in
Use sequenceA_ over sequence_ to report as many errors as we can
80c39dfNickolay Kudasov
src/Data/Swagger/Schema/Validate.hs+2−2
@@ -18,7 +18,7 @@ import Control.Lens
18import Control.Monad.Reader
18import Control.Monad.Reader
19
19
20import Data.Aeson
20import Data.Aeson
21−import Data.Foldable (traverse_, for_)
21+import Data.Foldable (traverse_, for_, sequenceA_)
22import Data.HashMap.Strict (HashMap)
22import Data.HashMap.Strict (HashMap)
23import qualified Data.HashMap.Strict as HashMap
23import qualified Data.HashMap.Strict as HashMap
24import qualified "unordered-containers" Data.HashSet as HashSet
24import qualified "unordered-containers" Data.HashSet as HashSet
@@ -134,7 +134,7 @@ validateWithSchema schema value
134 Just (SwaggerItemsArray itemSchemas) ->
134 Just (SwaggerItemsArray itemSchemas) ->
135 when (Vector.length xs /= length itemSchemas)
135 when (Vector.length xs /= length itemSchemas)
136 (invalid ("array size is invalid (should be exactly " ++ show (length itemSchemas) ++ "): " ++ show (encode xs)))
136 (invalid ("array size is invalid (should be exactly " ++ show (length itemSchemas) ++ "): " ++ show (encode xs)))
137− *> sequence_ (zipWith validateWithSchemaRef itemSchemas (Vector.toList xs))
137+ *> sequenceA_ (zipWith validateWithSchemaRef itemSchemas (Vector.toList xs))
138 Nothing -> invalid "invalid schema: array item schema expected"
138 Nothing -> invalid "invalid schema: array item schema expected"
139 *> when ((Just True == schema ^. uniqueItems) && not allUnique)
139 *> when ((Just True == schema ^. uniqueItems) && not allUnique)
140 (invalid $ "array is expected to contain unique items, but it does not: " ++ show (encode xs))
140 (invalid $ "array is expected to contain unique items, but it does not: " ++ show (encode xs))