git.iko.soy/typeable/openapi3
on master help sign in
Merge pull request #194 from wireapp/fix-inline-refs

Minor Cleanup

commitc1216634ae8aaa6362f34d3ac55ba0abb97f4797 authorfisx <mf@zerobuzz.net> dateTue 22 Oct 2019, 12:08 (7 years ago) parentdb0b8719b6c745
3 files changed+6−13
src/Data/Swagger/Internal/Schema/Validation.hs+5−5 test/Data/Swagger/CommonTestTypes.hs−2 test/Data/Swagger/SchemaSpec.hs+1−6
src/Data/Swagger/Internal/Schema/Validation.hs+5−5
@@ -22,6 +22,9 @@
2222-- Validate JSON values with Swagger Schema.
2323module Data.Swagger.Internal.Schema.Validation where
2424
25+import Prelude ()
26+import Prelude.Compat
27+
2528import Control.Applicative
2629import Control.Lens
2730import Control.Monad (when)
@@ -34,8 +37,6 @@ import Data.HashMap.Strict (HashMap)
3437import qualified Data.HashMap.Strict as HashMap
3538import qualified Data.HashMap.Strict.InsOrd as InsOrdHashMap
3639import qualified "unordered-containers" Data.HashSet as HashSet
37−import Data.List (intercalate)
38−import Data.Monoid
3940import Data.Proxy
4041import Data.Scientific (Scientific, isInteger)
4142import Data.Text (Text)
@@ -483,7 +484,7 @@ validateSchemaType value = withSchema $ \sch ->
483484 (Nothing, String s) -> sub_ paramSchema (validateString s)
484485 (Nothing, Array xs) -> sub_ paramSchema (validateArray xs)
485486 (Nothing, Object o) -> validateObject o
486− param@(t, _) -> invalid $ "expected JSON value of type " ++ showType param
487+ bad -> invalid $ "expected JSON value of type " ++ showType bad
487488
488489validateParamSchemaType :: Value -> Validation (ParamSchema t) ()
489490validateParamSchemaType value = withSchema $ \sch ->
@@ -498,8 +499,7 @@ validateParamSchemaType value = withSchema $ \sch ->
498499 (Nothing, Number n) -> validateNumber n
499500 (Nothing, String s) -> validateString s
500501 (Nothing, Array xs) -> validateArray xs
501− (t, _) -> invalid $ "expected JSON value of type " ++ show t
502− param@(t, _) -> invalid $ "expected JSON value of type " ++ showType param
502+ bad -> invalid $ "expected JSON value of type " ++ showType bad
503503
504504showType :: (Maybe (SwaggerType t), Value) -> String
505505showType (Just type_, _) = show type_
test/Data/Swagger/CommonTestTypes.hs−2
@@ -18,8 +18,6 @@ import qualified Data.Text as Text
1818import GHC.Generics
1919
2020import Data.Swagger
21−import Data.Swagger.Declare
22−import Data.Swagger.Internal (SwaggerKind (..))
2321
2422-- ========================================================================
2523-- Unit type
test/Data/Swagger/SchemaSpec.hs+1−6
@@ -8,16 +8,11 @@ import Prelude ()
88import Prelude.Compat
99
1010import Control.Lens ((^.))
11−import Data.Aeson (Value, ToJSON(..), ToJSONKey(..))
12−import Data.Aeson.Types (toJSONKeyText)
13−import Data.Aeson.QQ.Simple
14−import Data.Char
11+import Data.Aeson (Value)
1512import qualified Data.HashMap.Strict.InsOrd as InsOrdHashMap
1613import Data.Proxy
1714import Data.Set (Set)
18−import Data.Map (Map)
1915import qualified Data.Text as Text
20−import GHC.Generics
2116
2217import Data.Swagger
2318import Data.Swagger.Declare