Skip to content
This repository has been archived by the owner on Apr 19, 2022. It is now read-only.

Latest commit

 

History

History
35 lines (28 loc) · 786 Bytes

File metadata and controls

35 lines (28 loc) · 786 Bytes
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()
  ]
}