JSONSchema class final

The definition of a JSON Schema data type.

This class supports $ref and $defs for reusable sub-schemas.

Inheritance

Constructors

JSONSchema(SchemaType type, {String? format, String? description, String? title, bool? nullable, List<String>? enumValues, JSONSchema? items, int? minItems, int? maxItems, double? minimum, double? maximum, Map<String, JSONSchema>? properties, List<String>? optionalProperties, List<String>? propertyOrdering, List<JSONSchema>? anyOf, String? ref, Map<String, JSONSchema>? defs})
JSONSchema.anyOf({required List<JSONSchema> schemas})
Construct a schema representing a value that must conform to any (one or more) of the provided sub-schemas.
JSONSchema.array({required JSONSchema items, String? description, String? title, bool? nullable, int? minItems, int? maxItems})
Construct a schema for an array of values with a specified type.
JSONSchema.boolean({String? description, String? title, bool? nullable})
Construct a schema for bool value.
JSONSchema.enumString({required List<String> enumValues, String? description, String? title, bool? nullable})
Construct a schema for String value with enumerated possible values.
JSONSchema.integer({String? description, String? title, bool? nullable, int? minimum, int? maximum})
Construct a schema for an integer number.
JSONSchema.number({String? description, String? title, bool? nullable, double? minimum, double? maximum})
Construct a schema for a non-integer number.
JSONSchema.object({required Map<String, JSONSchema> properties, List<String>? optionalProperties, List<String>? propertyOrdering, String? description, String? title, bool? nullable, Map<String, JSONSchema>? defs})
Construct a schema for an object with one or more properties.
JSONSchema.ref(String ref)
Construct a schema referencing another schema.
JSONSchema.string({String? description, String? title, bool? nullable, String? format})
Construct a schema for a String value.

Properties

anyOf List<JSONSchema>?
An array of Schema objects to validate generated content.
covariantgetter/setter pairoverride
defs Map<String, JSONSchema>?
JSONSchema definitions for creating reusable sub-schemas.
getter/setter pair
description String?
A brief description of the parameter.
getter/setter pairinherited
enumValues List<String>?
Possible values if this is a SchemaType.string with an enum format.
getter/setter pairinherited
format String?
The format of the data.
getter/setter pairinherited
hashCode int
The hash code for this object.
no setterinherited
items JSONSchema?
JSONSchema for the elements if this is a SchemaType.array.
covariantgetter/setter pairoverride
maximum double?
The maximum value of a numeric type.
getter/setter pairinherited
maxItems int?
An integer specifying the maximum number of items SchemaType.array must contain.
getter/setter pairinherited
minimum double?
The minimum value of a numeric type.
getter/setter pairinherited
minItems int?
An integer specifying the minimum number of items SchemaType.array must contain.
getter/setter pairinherited
nullable bool?
Whether the value may be null.
getter/setter pairinherited
optionalProperties List<String>?
Optional Properties if this is a SchemaType.object.
getter/setter pairinherited
properties Map<String, JSONSchema>?
Properties of this type if this is a SchemaType.object.
covariantgetter/setter pairoverride
propertyOrdering List<String>?
Suggesting order of the properties.
getter/setter pairinherited
ref String?
Reference to another schema.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
title String?
A human-readable name/summary for the schema or a specific property.
getter/setter pairinherited
type SchemaType
The type of this value.
getter/setter pairinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, Object>
Convert to standard JSON JSONSchema object.
override
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited