type property

SchemaType get type

Get the schema type based on the union type

Implementation

SchemaType get type {
  return switch (this) {
    SchemaObject() => SchemaType.object,
    SchemaBoolean() => SchemaType.boolean,
    SchemaString() => SchemaType.string,
    SchemaInteger() => SchemaType.integer,
    SchemaNumber() => SchemaType.number,
    SchemaEnum() => SchemaType.enumeration,
    SchemaArray() => SchemaType.array,
    SchemaMap() => SchemaType.map,
    _ => throw StateError('Unknown schema type'),
  };
}