packages feed

swagger2 2.8 → 2.8.1

raw patch · 4 files changed

+16/−5 lines, 4 files

Files

CHANGELOG.md view
@@ -1,3 +1,8 @@+2.8.1+---++- Better error message in `validateSchemaType` (see [#221](https://github.com/GetShopTV/swagger2/pull/221));+ 2.8 --- 
src/Data/Swagger/Internal/Schema/Validation.hs view
@@ -485,7 +485,13 @@     (Nothing, String s)               -> sub_ paramSchema (validateString s)     (Nothing, Array xs)               -> sub_ paramSchema (validateArray xs)     (Nothing, Object o)               -> validateObject $ KM.toHashMapText o-    bad -> invalid $ "expected JSON value of type " ++ showType bad+    bad -> invalid $ unlines+      [ unwords ["expected JSON value of type", showType bad]+      , "  with context:"+      , "    " <> unwords ["SwaggerType:", show $ fst bad]+      , "    " <> unwords ["Aeson Value:", show $ snd bad]+      , "    " <> unwords ["Schema title:", show $ sch ^. title]+      ]  validateParamSchemaType :: Value -> Validation (ParamSchema t) () validateParamSchemaType value = withSchema $ \sch ->
src/Data/Swagger/Schema/Validation.hs view
@@ -71,11 +71,11 @@ -- generally fails for @null@ JSON: -- -- >>> validateToJSON (Nothing :: Maybe String)--- ["expected JSON value of type SwaggerString"]+-- ["expected JSON value of type SwaggerString\n  with context:\n    SwaggerType: Just SwaggerString\n    Aeson Value: Null\n    Schema title: Nothing\n"] -- >>> validateToJSON ([Just "hello", Nothing] :: [Maybe String])--- ["expected JSON value of type SwaggerString"]+-- ["expected JSON value of type SwaggerString\n  with context:\n    SwaggerType: Just SwaggerString\n    Aeson Value: Null\n    Schema title: Nothing\n"] -- >>> validateToJSON (123, Nothing :: Maybe String)--- ["expected JSON value of type SwaggerString"]+-- ["expected JSON value of type SwaggerString\n  with context:\n    SwaggerType: Just SwaggerString\n    Aeson Value: Null\n    Schema title: Nothing\n"] -- -- However, when @'Maybe' a@ is a type of a record field, -- validation takes @'required'@ property of the @'Schema'@
swagger2.cabal view
@@ -1,6 +1,6 @@ cabal-version:       >=1.10 name:                swagger2-version:             2.8+version:             2.8.1  synopsis:            Swagger 2.0 data model category:            Web, Swagger