pjson 2.0.0
A small, owning JSON value for C++11
Loading...
Searching...
No Matches
ByteDance::pJsonSchemaValidator::Error Struct Reference

One schema-compilation or instance-validation failure. More...

#include <pjson_schema.h>

Public Types

enum  Category { InstanceValidation , SchemaCompilation }
 Distinguishes an instance-validation failure from an invalid or unsupported schema contract discovered while compiling the validator. More...
 
enum  Code {
  None , FalseSchema , TypeMismatch , ConstMismatch ,
  EnumMismatch , NumericConstraint , StringConstraint , ArrayConstraint ,
  ObjectConstraint , FormatMismatch , CombinatorMismatch , ReferenceFailure ,
  ReferenceCycle , RegexFailure , UnsupportedKeyword , InvalidSchema ,
  UnsupportedDialect , UnsupportedVocabulary , ResolverFailure , ResourceLimit ,
  AllocationFailure , InternalError
}
 Stable machine-readable failure category. keyword identifies the precise keyword when several keywords share a category. More...
 

Public Member Functions

 Error (Code aCode, Category aCategory, const std::string &aInstanceLocation, const std::string &aSchemaLocation, const std::string &aKeyword, const std::string &aMessage)
 Constructs a fully located diagnostic.
 

Public Attributes

Code code
 Stable machine-readable failure category.
 
Category category
 Compilation or instance-validation phase.
 
std::string instanceLocation
 JSON Pointer into the instance; empty is root.
 
std::string schemaLocation
 Pointer or retrieval URI plus fragment for the schema.
 
std::string keyword
 Triggering keyword; empty for whole-schema failures.
 
std::string message
 Human-readable diagnostic, not a stable API token.
 
std::vector< Error > causes
 Optional bounded combinator branch failures. Constructs an empty diagnostic.
 

Detailed Description

One schema-compilation or instance-validation failure.

One schema or instance-validation failure.

Provides a stable code, separate instance and schema locations, the triggering keyword, human-readable text, and optional nested combinator causes. category distinguishes compilation from instance validation.

Definition at line 85 of file pjson_schema.h.

Member Enumeration Documentation

◆ Category

Distinguishes an instance-validation failure from an invalid or unsupported schema contract discovered while compiling the validator.

Enumerator
InstanceValidation 

The instance violates a valid schema.

SchemaCompilation 

The schema contract is invalid or unsupported.

Definition at line 88 of file pjson_schema.h.

◆ Code

Stable machine-readable failure category. keyword identifies the precise keyword when several keywords share a category.

Enumerator
None 

No failure.

FalseSchema 

A false boolean schema rejected the instance.

TypeMismatch 

The instance does not satisfy type.

ConstMismatch 

The instance does not satisfy const.

EnumMismatch 

The instance does not satisfy enum.

NumericConstraint 

A numeric assertion failed.

StringConstraint 

A string assertion failed.

ArrayConstraint 

An array assertion failed.

ObjectConstraint 

An object assertion failed.

FormatMismatch 

A known asserted format failed.

CombinatorMismatch 

A logical applicator did not satisfy its contract.

ReferenceFailure 

A schema reference could not be resolved.

ReferenceCycle 

Reference evaluation encountered a cycle.

RegexFailure 

A pattern was invalid or rejected by safety policy.

UnsupportedKeyword 

Strict mode found an unsupported standard keyword.

InvalidSchema 

A schema or keyword has an invalid shape or value.

UnsupportedDialect 

The selected schema dialect is unsupported.

UnsupportedVocabulary 

A required vocabulary is unsupported.

ResolverFailure 

The caller's external resolver could not load a schema.

ResourceLimit 

A compilation, validation, or diagnostic limit was hit.

AllocationFailure 

Validation could not allocate required temporary state.

InternalError 

An unexpected exception was contained.

Definition at line 95 of file pjson_schema.h.

Constructor & Destructor Documentation

◆ Error()

ByteDance::pJsonSchemaValidator::Error::Error ( Code  aCode,
Category  aCategory,
const std::string &  aInstanceLocation,
const std::string &  aSchemaLocation,
const std::string &  aKeyword,
const std::string &  aMessage 
)

Constructs a fully located diagnostic.

Member Data Documentation

◆ category

Category ByteDance::pJsonSchemaValidator::Error::category

Compilation or instance-validation phase.

Definition at line 121 of file pjson_schema.h.

◆ causes

std::vector<Error> ByteDance::pJsonSchemaValidator::Error::causes

Optional bounded combinator branch failures. Constructs an empty diagnostic.

Definition at line 126 of file pjson_schema.h.

◆ code

Code ByteDance::pJsonSchemaValidator::Error::code

Stable machine-readable failure category.

Definition at line 120 of file pjson_schema.h.

◆ instanceLocation

std::string ByteDance::pJsonSchemaValidator::Error::instanceLocation

JSON Pointer into the instance; empty is root.

Definition at line 122 of file pjson_schema.h.

◆ keyword

std::string ByteDance::pJsonSchemaValidator::Error::keyword

Triggering keyword; empty for whole-schema failures.

Definition at line 124 of file pjson_schema.h.

◆ message

std::string ByteDance::pJsonSchemaValidator::Error::message

Human-readable diagnostic, not a stable API token.

Definition at line 125 of file pjson_schema.h.

◆ schemaLocation

std::string ByteDance::pJsonSchemaValidator::Error::schemaLocation

Pointer or retrieval URI plus fragment for the schema.

Definition at line 123 of file pjson_schema.h.


The documentation for this struct was generated from the following file: