Title: | Another JSON Schema Validator |
---|---|
Description: | A thin wrapper around the 'ajv' JSON validation package for JavaScript. See <http://epoberezkin.github.io/ajv/> for details. |
Authors: | Jason Thorpe [aut, cre] |
Maintainer: | Jason Thorpe <[email protected]> |
License: | GPL-2 |
Version: | 1.0.0 |
Built: | 2025-02-21 03:14:43 UTC |
Source: | https://github.com/jdthorpe/ajvr |
Create an Ajv instnace (the equivalent of calling new Ajv()
in javascript)
Ajv(options = NULL)
Ajv(options = NULL)
options |
Optional; see the ajv github page for details |
Add a string format to an Ajv instance.
ajv.addFormat(this, key, format)
ajv.addFormat(this, key, format)
this |
An AJV instance, provided implicitly when called via |
key |
String; the name with format to add. |
format |
the format to be added. Note that JavaScript object literals
should be enclosed in a call to |
invisible(NULL)
Other AJV.Instance.Methods: ajv.addKeyword
,
ajv.addSchema
,
ajv.errorsText
, ajv.keyword
,
ajv.removeSchema
,
ajv.validateSchema
,
ajv.validate
## Not run: my_ajv_instance = Ajv() my_ajv_instance$keyword(key,object) ## End(Not run)
## Not run: my_ajv_instance = Ajv() my_ajv_instance$keyword(key,object) ## End(Not run)
The add a schema to an Ajv instance
ajv.addKeyword(this, name, definition)
ajv.addKeyword(this, name, definition)
this |
An AJV instance, provided implicitly when called via |
name |
The name of the keyword to be added. |
definition |
A string encoding of a javascript object to be used as to define the keyword. |
invisible(NULL)
Other AJV.Instance.Methods: ajv.addFormat
,
ajv.addSchema
,
ajv.errorsText
, ajv.keyword
,
ajv.removeSchema
,
ajv.validateSchema
,
ajv.validate
## Not run: my_ajv_instance = Ajv() my_ajv_instance$addSchema ## End(Not run)
## Not run: my_ajv_instance = Ajv() my_ajv_instance$addSchema ## End(Not run)
The add a schema to an Ajv instance
ajv.addSchema(this, schema, key)
ajv.addSchema(this, schema, key)
this |
An AJV instance, provided implicitly when called via |
schema |
The schema to be added.
|
key |
String; the name with which to store the schema |
invisible(NULL)
Other AJV.Instance.Methods: ajv.addFormat
,
ajv.addKeyword
,
ajv.errorsText
, ajv.keyword
,
ajv.removeSchema
,
ajv.validateSchema
,
ajv.validate
## Not run: my_ajv_instance = Ajv() my_ajv_instance$addSchema ## End(Not run)
## Not run: my_ajv_instance = Ajv() my_ajv_instance$addSchema ## End(Not run)
Create an Ajv validator function from a schema
ajv.compile(this, schema)
ajv.compile(this, schema)
this |
An AJV instance, provided implicitly when called via |
schema |
The Schema with which to validate the |
an AJV validation function
Extracts the errors object from
ajv.errorsText(this)
ajv.errorsText(this)
this |
An AJV instance, provided implicitly when called via |
JSON encoded object containing the error message (if any), with
class "AJV-errorsText" for pretty printing via print.errorsText
Other AJV.Instance.Methods: ajv.addFormat
,
ajv.addKeyword
,
ajv.addSchema
, ajv.keyword
,
ajv.removeSchema
,
ajv.validateSchema
,
ajv.validate
## Not run: my_ajv_instance = Ajv() my_ajv_instance$errorsText ## End(Not run)
## Not run: my_ajv_instance = Ajv() my_ajv_instance$errorsText ## End(Not run)
Create an Ajv validator function from a schema
ajv.getSchema(this, key)
ajv.getSchema(this, key)
this |
An AJV instance, provided implicitly when called via |
key |
String; the name of the schema to fetch from the Ajv instancd. |
an AJV validation function
Add a string format to an Ajv instance.
ajv.keyword(this, key, object)
ajv.keyword(this, key, object)
this |
An AJV instance, provided implicitly when called via |
key |
String; the name with keyword to add. |
object |
the format to be added. Must be enclosed in a call to
|
invisible(NULL)
Other AJV.Instance.Methods: ajv.addFormat
,
ajv.addKeyword
,
ajv.addSchema
,
ajv.errorsText
,
ajv.removeSchema
,
ajv.validateSchema
,
ajv.validate
## Not run: my_ajv_instance = Ajv() my_ajv_instance$keyword(key,object) ## End(Not run)
## Not run: my_ajv_instance = Ajv() my_ajv_instance$keyword(key,object) ## End(Not run)
The remove a schema from an Ajv instance
ajv.removeSchema(this, key)
ajv.removeSchema(this, key)
this |
An AJV instance, provided implicitly when called via |
key |
String; the name with schema to remove |
invisible(NULL)
Other AJV.Instance.Methods: ajv.addFormat
,
ajv.addKeyword
,
ajv.addSchema
,
ajv.errorsText
, ajv.keyword
,
ajv.validateSchema
,
ajv.validate
## Not run: my_ajv_instance = Ajv() my_ajv_instance$removeSchema ## End(Not run)
## Not run: my_ajv_instance = Ajv() my_ajv_instance$removeSchema ## End(Not run)
The equivalent of calling var ajv = new Ajv(); ajv.validate(...)
in javascript.
ajv.validate(this, schema, data)
ajv.validate(this, schema, data)
this |
An AJV instance, provided implicitly when called via |
schema |
The Schema with which to validate the |
data |
The data to be validated. may be any of the above foremats. |
Other AJV.Instance.Methods: ajv.addFormat
,
ajv.addKeyword
,
ajv.addSchema
,
ajv.errorsText
, ajv.keyword
,
ajv.removeSchema
,
ajv.validateSchema
## Not run: my_ajv_instance = Ajv() my_ajv_instance$validate ## End(Not run)
## Not run: my_ajv_instance = Ajv() my_ajv_instance$validate ## End(Not run)
The validate a json schema
ajv.validateSchema(this, schema)
ajv.validateSchema(this, schema)
this |
An AJV instance, provided implicitly when called via |
schema |
The Schema to be validated.
|
boolean
Other AJV.Instance.Methods: ajv.addFormat
,
ajv.addKeyword
,
ajv.addSchema
,
ajv.errorsText
, ajv.keyword
,
ajv.removeSchema
,
ajv.validate
## Not run: my_ajv_instance = Ajv() my_ajv_instance$validateSchema ## End(Not run)
## Not run: my_ajv_instance = Ajv() my_ajv_instance$validateSchema ## End(Not run)