libSmalldb  v0.7
Public Member Functions | Static Public Member Functions | Public Attributes | Static Protected Member Functions | List of all members
JsonSchemaReader Class Reference

Description

Load JSON schema from file and interpret extends_file directive.

Public Member Functions

 __construct ($filename)
 Constructor. More...
 
 __toString ()
 Render to JSON string, exporting fully expanded JSON schema. More...
 

Static Public Member Functions

static loadFile ($filename)
 Load file and create the renderer. More...
 
static parseFile ($filename, &$extendedFiles=null)
 Read and process file, read dependencies if exist. More...
 

Public Attributes

 $filename
 Name of loaded file. More...
 
 $schema
 Nested arrays representation of the schema. More...
 
 $extendedFiles = []
 List of extended files (parents) More...
 

Static Protected Member Functions

static extendSchema ($orig, $ext)
 Recursively merge two schemas extending $orig with $ext. More...
 
static annotateSchema ($schema, $annotation, $path= '')
 Annotate schema with an annotation. More...
 

Constructor & Destructor Documentation

__construct (   $filename)

Constructor.

Member Function Documentation

static loadFile (   $filename)
static

Load file and create the renderer.

static parseFile (   $filename,
$extendedFiles = null 
)
static

Read and process file, read dependencies if exist.

Parameters
[in]$filenameName of the file to parse and interpet.
[out]$extendedFilesList of files additionaly loaded via extends_file directive.
static extendSchema (   $orig,
  $ext 
)
staticprotected

Recursively merge two schemas extending $orig with $ext.

Like array_replace_recursive, but it concatenates lists instead of overwriting numeric keys.

Parameters
$origParent config.
$extChild config which extends the $parent.
static annotateSchema (   $schema,
  $annotation,
  $path = '' 
)
staticprotected

Annotate schema with an annotation.

__toString ( )

Render to JSON string, exporting fully expanded JSON schema.

Member Data Documentation

$filename

Name of loaded file.

$schema

Nested arrays representation of the schema.

$extendedFiles = []

List of extended files (parents)