permalink | title | category | gh_url |
---|---|---|---|
string |
string |
string |
Enforces the field value to be a valid string.
[note] The values transfered over HTTP are alawys string, which means this validation will always pass.
However, this validation rule is helpful for raw JSON requests, since after parsing the JSON strings, the server will get the actual content types and not a string.
In short, the rule has no impact for application/x-www-form-urlencoded
, but
helpful for application/json
content type.
[/note]
import { validations } from 'indicative/validator'
const rules = {
bio: 'string'
}
// or
const rules = {
bio: [
validations.string()
]
}