#FieldValueValidator Source

type FieldValueValidator m a = Validator m String (Maybe (Array String)) a

String error is transformed into Types.Error in "form" level validators

#array Source

#boolean Source

boolean :: forall m. Monad m => FieldValueValidator m Boolean

Encodes default browser behavior which sets checkbox value to "on" when checked and skips it completely when it is not. We consider also "off" value because we want to be more consistent when building API comunication layer - if you have any objections please fill an issue with description.

#field Source

field :: forall m e a. Monad m => String -> FieldValueValidator m a -> Validator m e Decoded a

#int Source

int :: forall m. Monad m => FieldValueValidator m Int

#number Source

#optional Source

#query Source

query :: forall e m. Monad m => Options -> Validator m e String Decoded

This module provides validators for urlencoded values. In general it follows "browsers standard" for encoding so it should be useful in the context of request validation. On the other hand if you want to build backend form validation solution on top of this it is probably better to take a look at Polyform.Validator.Reporter.

#string Source

Re-exports from Polyform.Validators.UrlEncoded.Parser

#Options Source

type Options = { replacePlus :: Boolean }

Browsers serialize space as + character which is incorrect according to the RFC 3986 but it is spread behavior accross tested engines.

I've written about this issue extensively:

If we want to be able to optionally distinct this + on the server side we have to convert it to %2b before decoding phase (as it is done in all investigated libraries - please check first post in the above thread).

Re-exports from Polyform.Validators.UrlEncoded.Types

#Validator Source

type Validator m e a b = Validator m (Error e) a b

#Error Source

type Error e = (urlDecoding :: String, urlValueParsing :: { error :: String, field :: String, input :: Maybe (Array String) } | e)

#Decoded Source

#_urlValueParsing Source

_urlValueParsing :: SProxy "urlValueParsing"

#_urlDecoding Source

_urlDecoding :: SProxy "urlDecoding"