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