Hoogle Search
Within LTS Haskell 24.25 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
renderValidationErrors :: (ToJSON a, ToSchema a) => (a -> [ValidationError]) -> a -> Maybe Stringopenapi3 Data.OpenApi.Internal.Schema.Validation Pretty print validation errors together with actual JSON and Swagger Schema (using encodePretty).
>>> import Data.Aeson as Aeson >>> import Data.Foldable (traverse_) >>> import GHC.Generics >>> data Phone = Phone { value :: String } deriving (Generic) >>> data Person = Person { name :: String, phone :: Phone } deriving (Generic) >>> instance ToJSON Person where toJSON p = object [ "name" Aeson..= name p ] >>> instance ToSchema Phone >>> instance ToSchema Person >>> let person = Person { name = "John", phone = Phone "123456" } >>> traverse_ putStrLn $ renderValidationErrors validateToJSON person Validation against the schema fails: * property "phone" is required, but not found in "{\"name\":\"John\"}" JSON value: { "name": "John" } Swagger Schema: { "properties": { "name": { "type": "string" }, "phone": { "$ref": "#/components/schemas/Phone" } }, "required": [ "name", "phone" ], "type": "object" } Swagger Description Context: { "Phone": { "properties": { "value": { "type": "string" } }, "required": [ "value" ], "type": "object" } }runValidation :: Validation s a -> Config -> s -> Result aopenapi3 Data.OpenApi.Internal.Schema.Validation No documentation available.
renderValidationErrors :: (ToJSON a, ToSchema a) => (a -> [ValidationError]) -> a -> Maybe Stringopenapi3 Data.OpenApi.Schema.Validation Pretty print validation errors together with actual JSON and Swagger Schema (using encodePretty).
>>> import Data.Aeson as Aeson >>> import Data.Foldable (traverse_) >>> import GHC.Generics >>> data Phone = Phone { value :: String } deriving (Generic) >>> data Person = Person { name :: String, phone :: Phone } deriving (Generic) >>> instance ToJSON Person where toJSON p = object [ "name" Aeson..= name p ] >>> instance ToSchema Phone >>> instance ToSchema Person >>> let person = Person { name = "John", phone = Phone "123456" } >>> traverse_ putStrLn $ renderValidationErrors validateToJSON person Validation against the schema fails: * property "phone" is required, but not found in "{\"name\":\"John\"}" JSON value: { "name": "John" } Swagger Schema: { "properties": { "name": { "type": "string" }, "phone": { "$ref": "#/components/schemas/Phone" } }, "required": [ "name", "phone" ], "type": "object" } Swagger Description Context: { "Phone": { "properties": { "value": { "type": "string" } }, "required": [ "value" ], "type": "object" } }package
crypton-x509-validation X.509 Certificate and CRL validation X.509 Certificate and CRL validation. please see README
defaultValidationCache :: ValidationCachecrypton-x509-validation Data.X509.Validation No documentation available.
exceptionValidationCache :: [(ServiceID, Fingerprint)] -> ValidationCachecrypton-x509-validation Data.X509.Validation create a simple constant cache that list exceptions to the certification validation. Typically this is use to allow self-signed certificates for specific use, with out-of-bounds user checks. No fingerprints will be added after the instance is created. The underlying structure for the check is kept as a list, as usually the exception list will be short, but when the list go above a dozen exceptions it's recommended to use another cache mechanism with a faster lookup mechanism (hashtable, map, etc). Note that only one fingerprint is allowed per ServiceID, for other use, another cache mechanism need to be use.
tofuValidationCache :: [(ServiceID, Fingerprint)] -> IO ValidationCachecrypton-x509-validation Data.X509.Validation Trust on first use (TOFU) cache with an optional list of exceptions this is similar to the exceptionCache, except that after each succesfull validation it does add the fingerprint to the database. This prevent any further modification of the fingerprint for the remaining
-
jose Crypto.JOSE.JWS No documentation available.
-
jose Crypto.JOSE.JWS No documentation available.
defaultValidationSettings :: ValidationSettingsjose Crypto.JOSE.JWS The default validation settings.
- All algorithms except "none" are acceptable.
- All signatures must be valid (and there must be at least one signature.)