Class Index | File Index

Classes


Class Environment


Defined in: jsv.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
An Environment is a sandbox of schemas thats behavior is different from other environments.
Method Summary
Method Attributes Method Name and Description
 
Returns a clone of the target environment.
 
Creates an empty schema.
 
createInstance(data, uri)
Returns a new JSONInstance of the provided data.
 
createSchema(data, schema, uri)
Creates a new JSONSchema from the provided data, and registers it with the environment.
 
Returns the schema registered with the provided URI.
 
Returns the default fragment delimiter of the environment.
 
Returns the default schema of the environment.
 
getOption(name)
Returns the specified environment option.
 
Sets the default fragment delimiter of the environment.
 
Sets the URI of the default schema for the environment.
 
setOption(name, value)
Sets the specified environment option to the specified value.
 
validate(instanceJSON, schemaJSON)
Validates both the provided schema and the provided instance, and returns a Report.
Class Detail
Environment()
An Environment is a sandbox of schemas thats behavior is different from other environments.
Method Detail
{Environment} clone()
Returns a clone of the target environment.
Returns:
{Environment} A new Environment that is a exact copy of the target environment

{JSONSchema} createEmptySchema()
Creates an empty schema.
Returns:
{JSONSchema} The empty schema, who's schema is itself.

{JSONInstance} createInstance(data, uri)
Returns a new JSONInstance of the provided data.
Parameters:
{JSONInstance|Any} data
The value of the instance
{String} uri Optional
The URI of the instance. If undefined, the URI will be a randomly generated UUID.
Returns:
{JSONInstance} A new JSONInstance from the provided data

{JSONSchema} createSchema(data, schema, uri)
Creates a new JSONSchema from the provided data, and registers it with the environment.
Parameters:
{JSONInstance|Any} data
The value of the schema
{JSONSchema|Boolean} schema Optional
The schema to bind to the instance. If undefined, the environment's default schema will be used. If true, the instance's schema will be itself.
{String} uri Optional
The URI of the schema. If undefined, the URI will be a randomly generated UUID.
Throws:
{InitializationError}
If a schema that is not registered with the environment is referenced
Returns:
{JSONSchema} A new JSONSchema from the provided data

{JSONSchema|undefined} findSchema(uri)
Returns the schema registered with the provided URI.
Parameters:
{String} uri
The absolute URI of the required schema
Returns:
{JSONSchema|undefined} The request schema, or undefined if not found

{String} getDefaultFragmentDelimiter()
Returns the default fragment delimiter of the environment.
Deprecated:
Use Environment#getOption with option "defaultFragmentDelimiter"
Returns:
{String} The fragment delimiter character

{JSONSchema} getDefaultSchema()
Returns the default schema of the environment.
Returns:
{JSONSchema} The default schema

{Any} getOption(name)
Returns the specified environment option.
Parameters:
{String} name
The name of the environment option to set
Returns:
{Any} The value of the environment option

setDefaultFragmentDelimiter(fd)
Sets the default fragment delimiter of the environment.
Parameters:
{String} fd
The fragment delimiter character
Deprecated:
Use Environment#setOption with option "defaultFragmentDelimiter"

setDefaultSchemaURI(uri)
Sets the URI of the default schema for the environment.
Parameters:
{String} uri
The default schema URI
Deprecated:
Use Environment#setOption with option "defaultSchemaURI"

setOption(name, value)
Sets the specified environment option to the specified value.
Parameters:
{String} name
The name of the environment option to set
{Any} value
The new value of the environment option

{Report} validate(instanceJSON, schemaJSON)
Validates both the provided schema and the provided instance, and returns a Report. If the schema fails to validate, the instance will not be validated.
Parameters:
{JSONInstance|Any} instanceJSON
The JSONInstance or JavaScript value to validate.
{JSONSchema|Any} schemaJSON
The JSONSchema or JavaScript value to use in the validation. This will also be validated againt the schema's schema.
Returns:
{Report} The result of the validation

Documentation generated by JsDoc Toolkit 2.4.0 on Wed Sep 14 2011 18:53:24 GMT-0600 (MDT)