JsonSchema class

Constructed with a json schema, either as string or Map. Validation of the schema itself is done on construction. Any errors in the schema result in a FormatException being thrown.

Properties

additionalItemsBool → bool
Whether additional items are allowed. [...]
read-only
additionalItemsSchema JsonSchema
JsonSchema additional items should conform to. [...]
read-only
additionalPropertiesBool → bool
Whether additional properties, other than those specified, are allowed. [...]
read-only
additionalPropertiesSchema JsonSchema
JsonSchema that additional properties must conform to. [...]
read-only
allOf → List<JsonSchema>
A List<JsonSchema> which the value must conform to all of. [...]
read-only
anyOf → List<JsonSchema>
A List<JsonSchema> which the value must conform to at least one of. [...]
read-only
constValue → dynamic
Const value of the JsonSchema. [...]
read-only
contains JsonSchema
JsonSchema definition that at least one item must match to be valid. [...]
read-only
defaultValue → dynamic
Default value of the JsonSchema. [...]
read-only
definitions → Map<String, JsonSchema>
Included JsonSchema definitions. [...]
read-only
description → String
Description of the JsonSchema. [...]
read-only
enumValues → List
Possible values of the JsonSchema. [...]
read-only
examples → List
List of example instances for the JsonSchema. [...]
read-only
exclusiveMaximum → num
The value of the exclusiveMaximum for the JsonSchema, if any exists.
read-only
exclusiveMinimum → num
The value of the exclusiveMaximum for the JsonSchema, if any exists.
read-only
format → String
Pre-defined format (i.e. date-time, email, etc) of the JsonSchema value.
read-only
hasConst → bool
Whether or not const is set, we need this since const can be null and valid. [...]
read-only
hasExclusiveMaximum → bool
Whether the maximum of the JsonSchema is exclusive.
read-only
hasExclusiveMinimum → bool
Whether the minimum of the JsonSchema is exclusive.
read-only
hashCode → int
The hash code for this object. [...]
read-only, override
id → Uri
ID of the JsonSchema.
read-only
items JsonSchema
Single JsonSchema sub items of this JsonSchema must conform to. [...]
read-only
itemsList → List<JsonSchema>
Ordered list of JsonSchema which the value of the same index must conform to. [...]
read-only
maximum → num
Maximum value of the JsonSchema value. [...]
read-only
maxItems → int
The maximum number of items allowed. [...]
read-only
maxLength → int
Maximum length of the JsonSchema value. [...]
read-only
maxProperties → int
The maximum number of properties allowed. [...]
read-only
minimum → num
Minimum value of the JsonSchema value. [...]
read-only
minItems → int
The minimum number of items allowed. [...]
read-only
minLength → int
Minimum length of the JsonSchema value. [...]
read-only
minProperties → int
The minimum number of properties allowed. [...]
read-only
multipleOf → num
The number which the value of the JsonSchema must be a multiple of. [...]
read-only
notSchema JsonSchema
A JsonSchema which the value must NOT be. [...]
read-only
oneOf → List<JsonSchema>
A List<JsonSchema> which the value must conform to at least one of. [...]
read-only
parent JsonSchema
The parent JsonSchema for this JsonSchema.
read-only
path → String
The path of the JsonSchema within the root JsonSchema.
read-only
pattern → RegExp
The regular expression the JsonSchema value must conform to. [...]
read-only
patternProperties → Map<RegExp, JsonSchema>
Map of JsonSchemas for properties, based on RegExps keys. [...]
read-only
properties → Map<String, JsonSchema>
Map of JsonSchemas for properties, by String key. [...]
read-only
propertyDependencies → Map<String, List<String>>
Map of property dependencies by property name. [...]
read-only
propertyName → String
Name of the property of the current JsonSchema within its parent.
read-only
propertyNamesSchema JsonSchema
JsonSchema that property names must conform to. [...]
read-only
ref → Uri
Ref to the URI of the JsonSchema.
read-only
refMap → Map<String, JsonSchema>
Map of sub-properties' and references' JsonSchemas by path. [...]
@Deprecated(''' Note: This information is useful for drawing dependency graphs, etc, but should not be used for general validation or traversal. Use [endPath] to get the absolute [String] path and [resolvePath] to get the [JsonSchema] at any path, instead. This functionality will be removed in 3.0. '''), read-only
requiredOnParent → bool
Whether the JsonSchema is required on its parent.
read-only
requiredProperties → List<String>
Properties that must be inclueded for the JsonSchema to be valid. [...]
read-only
root JsonSchema
The root JsonSchema for this JsonSchema.
read-only
runtimeType → Type
A representation of the runtime type of the object.
read-only, inherited
schemaBool → bool
JSON of the JsonSchema as a bool. Only this value or _schemaMap should be set, not both.
read-only
schemaDependencies → Map<String, JsonSchema>
Map of schema dependencies by property name. [...]
read-only
schemaMap → Map
JSON of the JsonSchema as a Map. Only this value or _schemaBool should be set, not both.
read-only
schemaVersion SchemaVersion
JSON Schema version used. [...]
read-only
title → String
Title of the JsonSchema. [...]
read-only
type SchemaType
Single allowable type for the JsonSchema. [...]
read-only
typeList → List<SchemaType>
List of allowable types for the JsonSchema. [...]
read-only
uniqueItems → bool
Whether the items in the list must be unique. [...]
read-only

Methods

endPath(String path) → String
Given a path within the schema, follow all references to an end path pointing to a JsonSchema.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
propertyRequired(String property) → bool
Whether a given property is required for the JsonSchema instance to be valid.
resolvePath(String path) JsonSchema
Get a nested JsonSchema from a path.
toJson() → String
JSON string represenatation of the schema.
toString() → String
Returns a string representation of this object.
override
validate(dynamic instance, {bool reportMultipleErrors = false, bool parseJson = false}) → bool
Validate instance against this schema, returning a boolean indicating whether validation succeeded or failed.
validateWithErrors(dynamic instance, {bool parseJson = false}) → List<ValidationError>
Validate instance against this schema, returning a list of ValidationError objects with information about any validation errors that occurred.

Operators

operator ==(dynamic other) → bool
The equality operator. [...]
override

Static Methods

createSchema(dynamic schema, {SchemaVersion schemaVersion, Uri fetchedFromUri, RefProvider refProvider}) JsonSchema
Create a schema from JSON data. [...]
createSchemaAsync(dynamic schema, {SchemaVersion schemaVersion, Uri fetchedFromUri, RefProviderAsync refProvider}) → Future<JsonSchema>
Create a schema from a JSON data. [...]
createSchemaFromUrl(String schemaUrl, {SchemaVersion schemaVersion}) → Future<JsonSchema>
Create a schema from a URL. [...]