| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Hasura.RQL.DDL.Webhook.Transform.Validation
Description
We validate TransformFn terms inside RequestTransform before
dispatching Metadata actions in runMetadataQueryV1M. Validation
follows the same HKD pattern from applyRequestTransform but using
btraverseC to call validate from the Transform class on all
the HKD fields.
Synopsis
- type Tuple1 a b = Compose ((,) a) b
- type OptionalTuple1 a b = WithOptional (Tuple1 a b)
- type ValidationFields = RequestFields (OptionalTuple1 TemplatingEngine TransformFn)
- transformFns :: Lens' RequestTransform ValidationFields
- validateRequestTransform :: MonadError TransformErrorBundle m => RequestTransform -> m RequestTransform
- newtype Unvalidated a = Unvalidated {
- _unUnvalidate :: a
- unUnvalidate :: Lens' (Unvalidated a) a
- newtype Unvalidated1 (f :: k -> Type) (a :: k) = Unvalidated1 {
- _unUnvalidate1 :: f a
- unUnvalidate1 :: Lens' (Unvalidated1 f a) (f a)
- validateTransforms :: MonadError QErr m => LensLike (Either TransformErrorBundle) api api RequestTransform RequestTransform -> (api -> m EncJSON) -> api -> m EncJSON
Documentation
type OptionalTuple1 a b = WithOptional (Tuple1 a b) Source #
type ValidationFields = RequestFields (OptionalTuple1 TemplatingEngine TransformFn) Source #
A variation on RequestTransformFn where TransformFn is tupled
with TemplatingEngine. This is necessary to validate the TransformFn.
TODO: In the future we most likely want to embed the
TemplatingEngine in the TransformFn or the
Template/UnwrappedTemplate, in which case we would not need
this alias for validation.
transformFns :: Lens' RequestTransform ValidationFields Source #
A lens for zipping our defunctionalized transform with the
TemplatingEngine for validation.
validateRequestTransform :: MonadError TransformErrorBundle m => RequestTransform -> m RequestTransform Source #
Validate all 'TransformFn a' fields in the RequestTransform.
newtype Unvalidated a Source #
Used to annotate that a RequestTransform, or some record
containing a RequestTransform has not yet been validated.
Constructors
| Unvalidated | |
Fields
| |
Instances
| FromJSON a => FromJSON (Unvalidated a) Source # | |
Defined in Hasura.RQL.DDL.Webhook.Transform.Validation | |
| ToJSON a => ToJSON (Unvalidated a) Source # | |
Defined in Hasura.RQL.DDL.Webhook.Transform.Validation Methods toJSON :: Unvalidated a -> Value toEncoding :: Unvalidated a -> Encoding toJSONList :: [Unvalidated a] -> Value toEncodingList :: [Unvalidated a] -> Encoding | |
unUnvalidate :: Lens' (Unvalidated a) a Source #
A lens for focusing through Unvalidated in validateTransforms.
newtype Unvalidated1 (f :: k -> Type) (a :: k) Source #
Used to annotate that a higher kinded type containing a
RequestTransform has not yet been validated.
This is needed specifically for CreateEventTriggerQuery and any
other type that is paramterized by a BackendType.
Constructors
| Unvalidated1 | |
Fields
| |
Instances
| FromJSON (f a) => FromJSON (Unvalidated1 f a) Source # | |
Defined in Hasura.RQL.DDL.Webhook.Transform.Validation Methods parseJSON :: Value -> Parser (Unvalidated1 f a) parseJSONList :: Value -> Parser [Unvalidated1 f a] | |
| ToJSON (f a) => ToJSON (Unvalidated1 f a) Source # | |
Defined in Hasura.RQL.DDL.Webhook.Transform.Validation Methods toJSON :: Unvalidated1 f a -> Value toEncoding :: Unvalidated1 f a -> Encoding toJSONList :: [Unvalidated1 f a] -> Value toEncodingList :: [Unvalidated1 f a] -> Encoding | |
unUnvalidate1 :: Lens' (Unvalidated1 f a) (f a) Source #
A lens for focusing through Unvalidated1 in validateTransforms.
validateTransforms :: MonadError QErr m => LensLike (Either TransformErrorBundle) api api RequestTransform RequestTransform -> (api -> m EncJSON) -> api -> m EncJSON Source #
Used to focus into a records in RQLMetadataV1 and validate any
RequestTransform terms present.