Schema constructor

  1. @JsonSerializable.new(includeIfNull: false, explicitToJson: true)
const Schema({
  1. @JsonKey.new(name: r'$ref') String? ref,
  2. String? type,
  3. String? format,
  4. String? title,
  5. String? description,
  6. @JsonKey.new(name: 'required') List<String>? $required,
  7. Map<String, Schema>? properties,
  8. Schema? items,
  9. dynamic example,
  10. @JsonKey.new(name: 'enum') List? enumValues,
  11. @JsonKey.new(name: 'default') dynamic $default,
  12. Xml? xml,
  13. @JsonKey.new(includeFromJson: false, includeToJson: false) dynamic additionalProperties,
  14. num? maximum,
  15. num? exclusiveMaximum,
  16. num? minimum,
  17. num? exclusiveMinimum,
  18. bool? readOnly,
  19. bool? writeOnly,
  20. ExternalDocs? externalDocs,
  21. Discriminator? discriminator,
  22. List<Schema>? allOf,
  23. List<Schema>? oneOf,
  24. List<Schema>? anyOf,
  25. Schema? not,
  26. bool? nullable,
  27. bool? allowEmptyValue,
  28. String? collectionFormat,
  29. int? maxLength,
  30. int? minLength,
  31. int? maxItems,
  32. int? minItems,
  33. String? pattern,
  34. bool? uniqueItems,
  35. int? maxProperties,
  36. int? minProperties,
  37. num? multipleOf,
  38. @JsonKey.new(name: 'deprecated') bool? $deprecated,
  39. @JsonKey.new(includeIfNull: false, includeFromJson: false, includeToJson: false) Map<String, dynamic>? extensions,
})

Creates a Schema object.

Implementation

@JsonSerializable(includeIfNull: false, explicitToJson: true)
const factory Schema({
  /// A reference to another Schema Object, typically in the `components`
  /// section.
  @JsonKey(name: r'$ref') String? ref,

  /// The data type of the schema (e.g., 'string', 'number', 'array').
  String? type,

  /// The format of the data type (e.g., 'int32', 'date-time', 'email').
  String? format,

  /// A title for the schema.
  String? title,

  /// A brief description of the schema.
  String? description,

  /// A list of properties that must be present in the object.
  @JsonKey(name: 'required') List<String>? $required,

  /// A map of property names to their respective [Schema] objects.
  Map<String, Schema>? properties,

  /// For array types, this describes the type of items in the array.
  Schema? items,

  /// An example value for the schema.
  dynamic example,

  /// A list of possible values for an enum.
  @JsonKey(name: 'enum') List<dynamic>? enumValues,

  /// The default value for the schema.
  @JsonKey(name: 'default') dynamic $default,

  /// This MAY be used only on properties schemas.
  /// It has no effect on root schemas.
  /// Adds Additional metadata to describe the XML representation format of
  /// this property.
  Xml? xml,

  /// Specifies the schema for any additional properties in the object.
  /// The value can be a boolean or a Schema object.
  @JsonKey(includeFromJson: false, includeToJson: false)
  dynamic additionalProperties,

  /// The maximum value for a number.
  num? maximum,

  /// The exclusive maximum value for a number.
  num? exclusiveMaximum,

  /// The minimum value for a number.
  num? minimum,

  /// The exclusive minimum value for a number.
  num? exclusiveMinimum,

  /// Relevant only for Schema Object properties definitions.
  /// Declares the property as "read only".
  bool? readOnly,

  /// Relevant only for Schema Object properties definitions.
  /// Declares the property as "write only".
  bool? writeOnly,

  /// A URL to external documentation for this schema.
  ExternalDocs? externalDocs,

  /// A **Discriminator** object for handling polymorphism.
  Discriminator? discriminator,

  /// An array of schemas where the data must be valid against all of
  /// the schemas.
  List<Schema>? allOf,

  /// An array of schemas where the data must be valid against one of
  /// the schemas.
  List<Schema>? oneOf,

  /// An array of schemas where the data must be valid against any of
  /// the schemas.
  List<Schema>? anyOf,

  /// A schema where the data must not be valid against this schema.
  Schema? not,

  /// A `true` value indicates that both `null` values and values of the
  /// specified `type` are allowed.
  bool? nullable,

  /// Sets the ability to pass empty-valued parameters.
  bool? allowEmptyValue,

  /// Determines the format of the array if type array is used.
  String? collectionFormat,

  /// See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.1.
  int? maxLength,

  /// integer See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.2.
  int? minLength,

  /// See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.2.
  int? maxItems,

  /// See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.3.
  int? minItems,

  /// string  See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.3.
  String? pattern,

  /// See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.3.3.
  bool? uniqueItems,

  /// See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.4.1
  int? maxProperties,

  /// See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.4.2
  int? minProperties,

  /// See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.1.
  num? multipleOf,

  /// Declares this schema as deprecated.
  @JsonKey(name: 'deprecated') bool? $deprecated,

  /// Vendor extensions (keys like `x-*`).
  @JsonKey(includeIfNull: false, includeFromJson: false, includeToJson: false)
  Map<String, dynamic>? extensions,
}) = _Schema;