Schema class abstract

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.new(unionKey: 'type', fallbackUnion: 'object')

Constructors

Schema.array({Xml? xml, String? title, String? description, @JsonKey.new(name: 'default') List? defaultValue, bool? nullable, dynamic example, @JsonKey.new(fromJson: _fromJsonInt) int? minItems, @JsonKey.new(fromJson: _fromJsonInt) int? maxItems, required Schema items, @JsonKey.new(name: '\$ref') String? ref})
A generic Schema of array type
const
factory
Schema.boolean({Xml? xml, String? title, String? description, @JsonKey.new(name: 'default') bool? defaultValue, bool? nullable, bool? example, @JsonKey.new(name: '\$ref') String? ref})
const
factory
Schema.enumeration({String? title, String? description, String? example, @JsonKey.new(name: 'default') String? defaultValue, bool? nullable, @JsonKey.new(includeToJson: false, includeFromJson: false) String? unknownValue, @JsonKey.new(name: 'enum') List<String>? values, @JsonKey.new(name: '\$ref') String? ref})
const
factory
Schema.fromJson(Map<String, dynamic> json)
Convert from JSON representation
factory
Schema.integer({Xml? xml, String? title, String? description, @JsonKey.new(name: 'default', fromJson: _fromJsonInt) int? defaultValue, bool? nullable, @JsonKey.new(unknownEnumValue: JsonKey.nullForUndefinedEnumValue) IntegerFormat? format, @JsonKey.new(fromJson: _fromJsonInt) int? example, @JsonKey.new(fromJson: _fromJsonInt) int? minimum, @JsonKey.new(fromJson: _fromJsonInt) int? maximum, @JsonKey.new(fromJson: _fromJsonInt) int? exclusiveMinimum, @JsonKey.new(fromJson: _fromJsonInt) int? exclusiveMaximum, @JsonKey.new(fromJson: _fromJsonInt) int? multipleOf, @JsonKey.new(name: '\$ref') String? ref})
An integer schema property
const
factory
Schema.map({Xml? xml, String? title, String? description, @JsonKey.new(name: 'default') Map? defaultValue, bool? nullable, Map? example, @JsonKey.new(name: 'additionalProperties', toJson: _toMapProps, fromJson: _fromMapProps) Schema? valueSchema, @JsonKey.new(name: '\$ref') String? ref})
A generic Schema of map type
const
factory
Schema.number({Xml? xml, String? title, String? description, @JsonKey.new(name: 'default', fromJson: _fromJsonDouble) double? defaultValue, bool? nullable, @JsonKey.new(unknownEnumValue: JsonKey.nullForUndefinedEnumValue) NumberFormat? format, @JsonKey.new(fromJson: _fromJsonDouble) double? example, @JsonKey.new(fromJson: _fromJsonDouble) double? minimum, @JsonKey.new(fromJson: _fromJsonDouble) double? maximum, @JsonKey.new(fromJson: _fromJsonInt) int? exclusiveMinimum, @JsonKey.new(fromJson: _fromJsonInt) int? exclusiveMaximum, @JsonKey.new(fromJson: _fromJsonDouble) double? multipleOf, @JsonKey.new(name: '\$ref') String? ref})
A number schema property
const
factory
Schema.object({String? title, String? description, @JsonKey.new(name: 'default') dynamic defaultValue, @JsonKey.new(name: '\$ref') String? ref, List<Schema>? allOf, List<Schema>? oneOf, List<Schema>? anyOf, List<String>? required, Discriminator? discriminator, ExternalDocs? externalDocs, Map<String, Schema>? properties, bool? nullable, Xml? xml})
const
factory
Schema.string({Xml? xml, String? title, String? description, @JsonKey.new(name: 'default') String? defaultValue, bool? nullable, @JsonKey.new(unknownEnumValue: JsonKey.nullForUndefinedEnumValue) StringFormat? format, String? pattern, String? example, @JsonKey.new(fromJson: _fromJsonInt) int? minLength, @JsonKey.new(fromJson: _fromJsonInt) int? maxLength, @JsonKey.new(fromJson: _fromJsonInt) int? exclusiveMinimum, @JsonKey.new(fromJson: _fromJsonInt) int? exclusiveMaximum, @JsonKey.new(name: '\$ref') String? ref})
const
factory

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
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDartType({Map<String, List<String>>? unions}) → String
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