Skip to content

Nimesia/json-schema-validator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


JsonSchemaValidator

JSON Schema Validator for Lucee

Table of Contents
  1. About The Project
  2. Usage

About The Project

Validating json data could be a real pain without the right tools. With this validator you can check whether a json is compliant with your schema and save yourself lots of if statements and useless code.

Usage

The main class is JSONSchemaValidator.cfc, inside the core folder.

The followings are the public methods you can use:

  • validate return an array of structures containing infos, messages, types and details of the errors.

    validate(required String json, required String schemaPath)
  • getAllErrors will return errors as a flat array

    getAllErrors(required String json, required String schemaPath)
  • addError lets you add custom errors

    addError(required String type, required String message, String pointer, Struct details) 

Thanks to

Alessio De Padova [email protected] for CF dev, Java dev and tests.

Chris Mair [email protected] for Java dev.

Roberto Marzialetti [email protected].

Everit Kft for JSON Schema Validator on which this wrapper is based.