packages feed

hedgehog-gen-json 0.4.0 → 0.5.0

raw patch · 3 files changed

+36/−3 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

hedgehog-gen-json.cabal view
@@ -2,10 +2,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: b22a7b9a7cb95c3f62c4308936bcc599b0cd199d24fa87256faf9f84595dcae6+-- hash: b6607e84b94f4b18937f5a00a356d91f02790f07d582597b20a9a8519d57bc96  name:           hedgehog-gen-json-version:        0.4.0+version:        0.5.0 synopsis:       JSON generators for Hedgehog description:    Generate JSON values for Hedgehog tests category:       Test
src/Hedgehog/Gen/JSON/Constrained.hs view
@@ -30,6 +30,18 @@ genValue :: Ranges -> ToplevelSchema -> Schema -> Gen Aeson.Value genValue ranges tschema schema   | isJust (schema ^. schemaRef) = genReferencedSchema ranges tschema schema+  | isJust (schema ^. schemaAnyOf) = +    case schema ^. schemaAnyOf of+      Just (AnyConstraintAnyOf ss) -> Gen.element (toList ss) >>= genValue ranges tschema+      Nothing                      -> empty+  | isJust (schema ^. schemaOneOf) = +    case schema ^. schemaOneOf of+      Just (AnyConstraintOneOf ss) -> Gen.element (toList ss) >>= genValue ranges tschema+      Nothing                      -> empty+  | isJust (schema ^. schemaAllOf) = +    case schema ^. schemaAllOf of+      Just (AnyConstraintAllOf ss) -> Gen.element (toList ss) >>= genValue ranges tschema+      Nothing                      -> empty   | isJust (schema ^. schemaEnum) =     case schema ^. schemaEnum of       Just (AnyConstraintEnum vs) -> (Gen.element . toList) vs
src/Hedgehog/Gen/JSON/JSONSchema.hs view
@@ -110,7 +110,10 @@       obj .:? "minItems" <*>       obj .:? "uniqueItems" <*>       obj .:? "$ref" <*>-      obj .:? "definitions"+      obj .:? "definitions" <*>+      obj .:? "anyOf" <*>+      obj .:? "oneOf" <*>+      obj .:? "allOf"  newtype ToplevelSchema = ToplevelSchema {   unToplevelSchema :: Schema@@ -132,6 +135,18 @@   { unAnyConstraintDefinitions :: HM.HashMap Text Schema   } deriving (Generic, Eq, Show, Aeson.FromJSON) +newtype AnyConstraintAllOf = AnyConstraintAllOf+  { unAnyConstraintAllOf :: NonEmpty Schema+  } deriving (Generic, Eq, Show, Aeson.FromJSON)++newtype AnyConstraintOneOf = AnyConstraintOneOf+  { unAnyConstraintOneOf :: NonEmpty Schema+  } deriving (Generic, Eq, Show, Aeson.FromJSON)++newtype AnyConstraintAnyOf = AnyConstraintAnyOf+  { unAnyConstraintAnyOf :: NonEmpty Schema+  } deriving (Generic, Eq, Show, Aeson.FromJSON)+ newtype ArrayConstraintItems = ArrayConstraintItems   { unArrayConstraintItems :: Schema   } deriving (Generic, Eq, Show, Aeson.FromJSON)@@ -169,6 +184,9 @@   , _schemaUniqueItems      :: Maybe ArrayConstraintUniqueItems   , _schemaRef              :: Maybe AnyConstraintRef   , _schemaDefinitions      :: Maybe AnyConstraintDefinitions+  , _schemaAnyOf            :: Maybe AnyConstraintAnyOf+  , _schemaOneOf            :: Maybe AnyConstraintOneOf+  , _schemaAllOf            :: Maybe AnyConstraintAllOf   } deriving (Generic, Eq, Show)  emptySchema :: Schema@@ -194,6 +212,9 @@     , _schemaUniqueItems = Nothing     , _schemaRef = Nothing     , _schemaDefinitions = Nothing+    , _schemaAnyOf = Nothing+    , _schemaOneOf = Nothing+    , _schemaAllOf = Nothing     }  makeLenses ''Schema