ajv-base64
Adds a base64
format to Ajv.
Install
npm install ajv-base64
or
yarn add ajv-base64
Note that this package isn't very useful without Ajv itself, so you should install that as well.
Setup
const Ajv = ;const ajv = ;ajv;
Usage
When defining your JSON schema, use the format
keyword with the value set to base64
. For example:
Valid data:
{ cursor: "YWJj" }
{ cursor: "SGVsbG8sIHdvcmxkIQ==" }
Invalid data:
{ cursor: "" }
{ cursor: "Hello, world!" }
{ cursor: "🔥" }