Schema class
The Schema object allows the definition of input and output data types. These types can be objects, but also primitives and arrays
https://swagger.io/specification/#schema-object https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md
- Annotations
-
- @Freezed(unionKey: 'type', fallbackUnion: 'object')
Constructors
- Schema.array({Xml? xml, String? title, String? description, @JsonKey(name: 'default') List? defaultValue, bool? nullable, dynamic example, @JsonKey(fromJson: _fromJsonInt) int? minItems, @JsonKey(fromJson: _fromJsonInt) int? maxItems, required Schema items, @JsonKey(name: '\$ref') @_SchemaRefConverter() String? ref})
-
A generic Schema of array type
constfactory
- Schema.boolean({Xml? xml, String? title, String? description, @JsonKey(name: 'default') bool? defaultValue, bool? nullable, bool? example, @JsonKey(name: '\$ref') @_SchemaRefConverter() String? ref})
-
constfactory
-
Schema.enumeration({String? title, String? description, String? example, @JsonKey(name: 'default') String? defaultValue, bool? nullable, @JsonKey(includeToJson: false, includeFromJson: false) String? unknownValue, @JsonKey(name: 'enum') List<
String> ? values, @JsonKey(name: '\$ref') @_SchemaRefConverter() String? ref}) -
constfactory
-
Schema.fromJson(Map<
String, dynamic> json) -
Convert from JSON representation
factory
- Schema.integer({Xml? xml, String? title, String? description, @JsonKey(name: 'default', fromJson: _fromJsonInt) int? defaultValue, bool? nullable, @JsonKey(unknownEnumValue: JsonKey.nullForUndefinedEnumValue) IntegerFormat? format, @JsonKey(fromJson: _fromJsonInt) int? example, @JsonKey(fromJson: _fromJsonInt) int? minimum, @JsonKey(fromJson: _fromJsonInt) int? maximum, bool? exclusiveMinimum, bool? exclusiveMaximum, @JsonKey(fromJson: _fromJsonInt) int? multipleOf, @JsonKey(name: '\$ref') @_SchemaRefConverter() String? ref})
-
An integer schema property
constfactory
- Schema.map({Xml? xml, String? title, String? description, @JsonKey(name: 'default') Map? defaultValue, bool? nullable, Map? example, @JsonKey(name: 'additionalProperties', toJson: _toMapProps, fromJson: _fromMapProps) Schema? valueSchema, @JsonKey(name: '\$ref') @_SchemaRefConverter() String? ref})
-
A generic Schema of map type
constfactory
- Schema.number({Xml? xml, String? title, String? description, @JsonKey(name: 'default', fromJson: _fromJsonDouble) double? defaultValue, bool? nullable, @JsonKey(unknownEnumValue: JsonKey.nullForUndefinedEnumValue) NumberFormat? format, @JsonKey(fromJson: _fromJsonDouble) double? example, @JsonKey(fromJson: _fromJsonDouble) double? minimum, @JsonKey(fromJson: _fromJsonDouble) double? maximum, bool? exclusiveMinimum, bool? exclusiveMaximum, @JsonKey(fromJson: _fromJsonDouble) double? multipleOf, @JsonKey(name: '\$ref') @_SchemaRefConverter() String? ref})
-
A number schema property
constfactory
-
Schema.object({String? title, String? description, @JsonKey(name: 'default') dynamic defaultValue, @JsonKey(name: '\$ref') @_SchemaRefConverter() String? ref, @_SchemaListConverter() List<
Schema> ? allOf, @_SchemaListConverter() List<Schema> ? oneOf, @_SchemaListConverter() List<Schema> ? anyOf, List<String> ? required, Discriminator? discriminator, ExternalDocs? externalDocs, Map<String, Schema> ? properties, bool? nullable, Xml? xml}) -
constfactory
- Schema.string({Xml? xml, String? title, String? description, @JsonKey(name: 'default') String? defaultValue, bool? nullable, @JsonKey(unknownEnumValue: JsonKey.nullForUndefinedEnumValue) StringFormat? format, String? pattern, String? example, @JsonKey(fromJson: _fromJsonInt) int? minLength, @JsonKey(fromJson: _fromJsonInt) int? maxLength, bool? exclusiveMinimum, bool? exclusiveMaximum, @JsonKey(name: '\$ref') @_SchemaRefConverter() String? ref})
-
constfactory
Properties
-
copyWith
→ $SchemaCopyWith<
Schema> -
Create a copy of Schema
with the given fields replaced by the non-null parameter values.
no setterinherited
- defaultValue → dynamic
-
The default value code to place into
@Default()
no setterinherited - description → String?
-
A short description of the schema
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- nullable → bool?
-
Define if this scheme is nullable
no setterinherited
- ref → String?
-
Reference to a schema definition
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- title → String?
-
A summary title of the schema
no setterinherited
- type → SchemaType
-
Get the schema type based on the union type
no setter
Methods
-
dereference(
{required Map< String, Schema> ? components}) → Schema -
map<
TResult extends Object?> ({required TResult object(SchemaObject value), required TResult boolean(SchemaBoolean value), required TResult string(SchemaString value), required TResult integer(SchemaInteger value), required TResult number(SchemaNumber value), required TResult enumeration(SchemaEnum value), required TResult array(SchemaArray value), required TResult map(SchemaMap value)}) → TResult -
inherited
-
mapOrNull<
TResult extends Object?> ({TResult? object(SchemaObject value)?, TResult? boolean(SchemaBoolean value)?, TResult? string(SchemaString value)?, TResult? integer(SchemaInteger value)?, TResult? number(SchemaNumber value)?, TResult? enumeration(SchemaEnum value)?, TResult? array(SchemaArray value)?, TResult? map(SchemaMap value)?}) → TResult? -
inherited
-
maybeMap<
TResult extends Object?> ({TResult object(SchemaObject value)?, TResult boolean(SchemaBoolean value)?, TResult string(SchemaString value)?, TResult integer(SchemaInteger value)?, TResult number(SchemaNumber value)?, TResult enumeration(SchemaEnum value)?, TResult array(SchemaArray value)?, TResult map(SchemaMap value)?, required TResult orElse()}) → TResult -
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDartType(
{Map< String, List< ? unions}) → StringString> > - Return a proper Dart type for this schema
-
toJson(
) → Map< String, dynamic> -
Serializes this Schema to a JSON map.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited