SpecConverter class abstract

Custom schema converter for complex types.

Implement this interface to provide custom schema generation logic for types that need special handling.

class MoneyConverter implements SpecConverter {
  const MoneyConverter();

  @override
  Map<String, dynamic> convert() {
    return {
      'type': 'object',
      'properties': {
        'amount': {'type': 'number'},
        'currency': {'type': 'string', 'minLength': 3, 'maxLength': 3},
      },
      'required': ['amount', 'currency'],
    };
  }
}

Constructors

SpecConverter()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

convert() Map<String, dynamic>
Converts the annotated type to a schema map.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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