Skip to content

Instantly share code, notes, and snippets.

@mbriggs
Created May 11, 2023 03:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mbriggs/04e71f9ef4e4be5561c8cbf62280a3c8 to your computer and use it in GitHub Desktop.
Save mbriggs/04e71f9ef4e4be5561c8cbf62280a3c8 to your computer and use it in GitHub Desktop.
# typed: true
# DO NOT EDIT MANUALLY
# This is an autogenerated file for types exported from the `data_model` gem.
# Please instead update this file by running `bin/tapioca gem data_model`.
# source://data_model//lib/data_model.rb#15
module DataModel
extend ::DataModel
# Scan a schema and create a data model, which is a configured type.
#
# source://data_model//lib/data_model.rb#31
sig { params(schema: T::Array[::Object], registry: ::DataModel::TypeRegistry).returns(::DataModel::Model) }
def define(schema, registry: T.unsafe(nil)); end
end
# fills in for lack of boolean type in ruby
#
# source://data_model//lib/data_model/boolean.rb#5
class DataModel::Boolean; end
# source://data_model//lib/data_model/builtin.rb#4
module DataModel::Builtin
class << self
# source://data_model//lib/data_model/builtin.rb#8
sig { returns(T::Hash[::Symbol, T.class_of(DataModel::Type)]) }
def types; end
end
end
# source://data_model//lib/data_model/builtin/array.rb#4
class DataModel::Builtin::Array < ::DataModel::Type
include ::DataModel::Errors
# source://data_model//lib/data_model/builtin/array.rb#30
sig { returns(::DataModel::Type) }
def child_type; end
# source://data_model//lib/data_model/builtin/array.rb#17
sig { override.params(params: T::Array[::Object]).void }
def configure(params); end
# source://data_model//lib/data_model/builtin/array.rb#39
sig { override.params(val: ::Object, coerce: T::Boolean).returns([::Object, ::DataModel::Error]) }
def read(val, coerce: T.unsafe(nil)); end
end
# source://data_model//lib/data_model/builtin/array.rb#7
class DataModel::Builtin::Array::Arguments < ::T::Struct
prop :optional, T::Boolean, default: T.unsafe(nil)
prop :wrap_single_value, T::Boolean, default: T.unsafe(nil)
prop :min, T.nilable(T.any(::BigDecimal, ::Float, ::Integer, ::Rational)), default: T.unsafe(nil)
prop :max, T.nilable(T.any(::BigDecimal, ::Float, ::Integer, ::Rational)), default: T.unsafe(nil)
prop :length, T.nilable(T.any(::BigDecimal, ::Float, ::Integer, ::Rational)), default: T.unsafe(nil)
class << self
# source://sorbet-runtime/0.5.10810/lib/types/struct.rb#13
def inherited(s); end
end
end
# source://data_model//lib/data_model/builtin/big_decimal.rb#4
class DataModel::Builtin::BigDecimal < ::DataModel::Type
include ::DataModel::Errors
# source://data_model//lib/data_model/builtin/big_decimal.rb#14
sig { override.params(val: ::Object, coerce: T::Boolean).returns([::Object, ::DataModel::Error]) }
def read(val, coerce: T.unsafe(nil)); end
end
# source://data_model//lib/data_model/builtin/big_decimal.rb#7
class DataModel::Builtin::BigDecimal::Arguments < ::T::Struct
prop :optional, T::Boolean, default: T.unsafe(nil)
prop :min, T.nilable(T.any(::BigDecimal, ::Float, ::Integer, ::Rational)), default: T.unsafe(nil)
prop :max, T.nilable(T.any(::BigDecimal, ::Float, ::Integer, ::Rational)), default: T.unsafe(nil)
class << self
# source://sorbet-runtime/0.5.10810/lib/types/struct.rb#13
def inherited(s); end
end
end
# source://data_model//lib/data_model/builtin/boolean.rb#4
class DataModel::Builtin::Boolean < ::DataModel::Type
include ::DataModel::Errors
# source://data_model//lib/data_model/builtin/boolean.rb#12
sig { override.params(val: ::Object, coerce: T::Boolean).returns([::Object, ::DataModel::Error]) }
def read(val, coerce: T.unsafe(nil)); end
end
# source://data_model//lib/data_model/builtin/boolean.rb#7
class DataModel::Builtin::Boolean::Arguments < ::T::Struct
prop :optional, T::Boolean, default: T.unsafe(nil)
class << self
# source://sorbet-runtime/0.5.10810/lib/types/struct.rb#13
def inherited(s); end
end
end
# source://data_model//lib/data_model/builtin/date.rb#4
class DataModel::Builtin::Date < ::DataModel::Type
include ::DataModel::Errors
# source://data_model//lib/data_model/builtin/date.rb#14
sig { override.params(val: ::Object, coerce: T::Boolean).returns([::Object, ::DataModel::Error]) }
def read(val, coerce: T.unsafe(nil)); end
end
# source://data_model//lib/data_model/builtin/date.rb#7
class DataModel::Builtin::Date::Arguments < ::T::Struct
prop :optional, T::Boolean, default: T.unsafe(nil)
prop :earliest, T.nilable(::Date), default: T.unsafe(nil)
prop :latest, T.nilable(::Date), default: T.unsafe(nil)
class << self
# source://sorbet-runtime/0.5.10810/lib/types/struct.rb#13
def inherited(s); end
end
end
# source://data_model//lib/data_model/builtin/float.rb#4
class DataModel::Builtin::Float < ::DataModel::Type
include ::DataModel::Errors
# source://data_model//lib/data_model/builtin/float.rb#14
sig { override.params(val: ::Object, coerce: T::Boolean).returns([::Object, ::DataModel::Error]) }
def read(val, coerce: T.unsafe(nil)); end
end
# source://data_model//lib/data_model/builtin/float.rb#7
class DataModel::Builtin::Float::Arguments < ::T::Struct
prop :optional, T::Boolean, default: T.unsafe(nil)
prop :min, T.nilable(T.any(::BigDecimal, ::Float, ::Integer, ::Rational)), default: T.unsafe(nil)
prop :max, T.nilable(T.any(::BigDecimal, ::Float, ::Integer, ::Rational)), default: T.unsafe(nil)
class << self
# source://sorbet-runtime/0.5.10810/lib/types/struct.rb#13
def inherited(s); end
end
end
# source://data_model//lib/data_model/builtin/hash.rb#5
class DataModel::Builtin::Hash < ::DataModel::Type
include ::DataModel::Errors
include ::DataModel::Logging
# source://data_model//lib/data_model/builtin/hash.rb#41
sig { returns(T::Hash[::Symbol, ::DataModel::Type]) }
def children; end
# source://data_model//lib/data_model/builtin/hash.rb#17
sig { override.params(params: T::Array[::Object]).void }
def configure(params); end
# source://data_model//lib/data_model/builtin/hash.rb#52
sig { override.params(val: ::Object, coerce: T::Boolean).returns([::Object, ::DataModel::Error]) }
def read(val, coerce: T.unsafe(nil)); end
end
# source://data_model//lib/data_model/builtin/hash.rb#9
class DataModel::Builtin::Hash::Arguments < ::T::Struct
prop :optional, T::Boolean, default: T.unsafe(nil)
prop :open, T::Boolean, default: T.unsafe(nil)
class << self
# source://sorbet-runtime/0.5.10810/lib/types/struct.rb#13
def inherited(s); end
end
end
# source://data_model//lib/data_model/builtin/integer.rb#4
class DataModel::Builtin::Integer < ::DataModel::Type
include ::DataModel::Errors
# source://data_model//lib/data_model/builtin/integer.rb#14
sig { override.params(val: ::Object, coerce: T::Boolean).returns([::Object, ::DataModel::Error]) }
def read(val, coerce: T.unsafe(nil)); end
end
# source://data_model//lib/data_model/builtin/integer.rb#7
class DataModel::Builtin::Integer::Arguments < ::T::Struct
prop :optional, T::Boolean, default: T.unsafe(nil)
prop :min, T.nilable(T.any(::BigDecimal, ::Float, ::Integer, ::Rational)), default: T.unsafe(nil)
prop :max, T.nilable(T.any(::BigDecimal, ::Float, ::Integer, ::Rational)), default: T.unsafe(nil)
class << self
# source://sorbet-runtime/0.5.10810/lib/types/struct.rb#13
def inherited(s); end
end
end
# source://data_model//lib/data_model/builtin/string.rb#4
class DataModel::Builtin::String < ::DataModel::Type
include ::DataModel::Errors
# source://data_model//lib/data_model/builtin/string.rb#15
sig { override.params(val: ::Object, coerce: T::Boolean).returns([::Object, ::DataModel::Error]) }
def read(val, coerce: T.unsafe(nil)); end
end
# source://data_model//lib/data_model/builtin/string.rb#7
class DataModel::Builtin::String::Arguments < ::T::Struct
prop :optional, T::Boolean, default: T.unsafe(nil)
prop :allow_blank, T::Boolean, default: T.unsafe(nil)
prop :included, T::Array[::String], default: T.unsafe(nil)
prop :excluded, T::Array[::String], default: T.unsafe(nil)
class << self
# source://sorbet-runtime/0.5.10810/lib/types/struct.rb#13
def inherited(s); end
end
end
# source://data_model//lib/data_model/builtin/symbol.rb#4
class DataModel::Builtin::Symbol < ::DataModel::Type
include ::DataModel::Errors
# source://data_model//lib/data_model/builtin/symbol.rb#14
sig { override.params(val: ::Object, coerce: T::Boolean).returns([::Object, ::DataModel::Error]) }
def read(val, coerce: T.unsafe(nil)); end
end
# source://data_model//lib/data_model/builtin/symbol.rb#7
class DataModel::Builtin::Symbol::Arguments < ::T::Struct
prop :optional, T::Boolean, default: T.unsafe(nil)
prop :included, T::Array[::Symbol], default: T.unsafe(nil)
prop :excluded, T::Array[::Symbol], default: T.unsafe(nil)
class << self
# source://sorbet-runtime/0.5.10810/lib/types/struct.rb#13
def inherited(s); end
end
end
# source://data_model//lib/data_model/builtin/time.rb#4
class DataModel::Builtin::Time < ::DataModel::Type
include ::DataModel::Errors
# source://data_model//lib/data_model/builtin/time.rb#14
sig { override.params(val: ::Object, coerce: T::Boolean).returns([::Object, ::DataModel::Error]) }
def read(val, coerce: T.unsafe(nil)); end
end
# source://data_model//lib/data_model/builtin/time.rb#7
class DataModel::Builtin::Time::Arguments < ::T::Struct
prop :optional, T::Boolean, default: T.unsafe(nil)
prop :earliest, T.nilable(::Time), default: T.unsafe(nil)
prop :latest, T.nilable(::Time), default: T.unsafe(nil)
class << self
# source://sorbet-runtime/0.5.10810/lib/types/struct.rb#13
def inherited(s); end
end
end
# Error is a class that holds errors.
#
# source://data_model//lib/data_model/error.rb#5
class DataModel::Error
# source://data_model//lib/data_model/error.rb#12
sig { void }
def initialize; end
# Add an error to the error list.
#
# source://data_model//lib/data_model/error.rb#63
sig { params(err: [::Symbol, ::Object], child: T.nilable(T.any(::Symbol, T::Array[::Symbol]))).void }
def add(err, child: T.unsafe(nil)); end
# all errors
#
# source://data_model//lib/data_model/error.rb#31
sig { returns(T::Hash[::Symbol, T::Array[[::Symbol, ::Object]]]) }
def all; end
# Returns true if any errors are present.
#
# source://data_model//lib/data_model/error.rb#39
sig { params(blk: T.nilable(T.proc.params(error: [::Symbol, ::Object]).returns(T::Boolean))).returns(T::Boolean) }
def any?(&blk); end
# errors related to the object as a whole
#
# source://data_model//lib/data_model/error.rb#19
sig { returns(T::Array[[::Symbol, ::Object]]) }
def base; end
# errors related children
#
# source://data_model//lib/data_model/error.rb#25
sig { returns(T::Hash[::Symbol, T::Array[[::Symbol, ::Object]]]) }
def children; end
# source://data_model//lib/data_model/error.rb#57
sig { returns(T::Boolean) }
def empty?; end
# source://data_model//lib/data_model/error.rb#77
sig { params(name: ::Symbol, child: ::DataModel::Error).void }
def merge_child(name, child); end
# all errors
#
# @return [TErrorMap]
#
# source://sorbet-runtime/0.5.10810/lib/types/private/methods/_methods.rb#255
def to_h(*args, **_arg1, &blk); end
# source://data_model//lib/data_model/error.rb#98
sig { params(blk: T.proc.params(context: ::Object, type: ::Symbol).returns(::Object)).void }
def transform_child_context(&blk); end
# source://data_model//lib/data_model/error.rb#90
sig { params(blk: T.proc.params(context: ::Object, type: ::Symbol).returns(::Object)).void }
def transform_context(&blk); end
end
# source://data_model//lib/data_model/error.rb#8
DataModel::Error::TErrorList = T.type_alias { T::Array[[::Symbol, ::Object]] }
# source://data_model//lib/data_model/error.rb#9
DataModel::Error::TErrorMap = T.type_alias { T::Hash[::Symbol, T::Array[[::Symbol, ::Object]]] }
# Provide Error building functionality as a mixin
#
# source://data_model//lib/data_model/errors.rb#5
module DataModel::Errors
# Blank error applies when a value is blank
#
# source://data_model//lib/data_model/errors.rb#45
sig { returns([::Symbol, ::Object]) }
def blank_error; end
# Generate a message for a blank error
#
# source://data_model//lib/data_model/errors.rb#113
sig { returns(::String) }
def blank_error_message; end
# Coerce error applies when a value cannot be coerced to the expected type
#
# source://data_model//lib/data_model/errors.rb#21
sig { params(cls: T.class_of(Object), value: ::Object).returns([::Symbol, ::Object]) }
def coerce_error(cls, value); end
# Generate a message for a coerce error
#
# source://data_model//lib/data_model/errors.rb#89
sig { params(cls: T.class_of(Object), value: ::Object).returns(::String) }
def coerce_error_message(cls, value); end
# Earliest applies when value is earlier then earliest
#
# source://data_model//lib/data_model/errors.rb#69
sig do
params(
earliest: T.any(::Date, ::DateTime, ::Time),
val: T.any(::Date, ::DateTime, ::Time)
).returns([::Symbol, ::Object])
end
def earliest_error(earliest, val); end
# Generate a message for a value that occurs earlier then the specified earliest point
#
# source://data_model//lib/data_model/errors.rb#137
sig { params(earliest: T.any(::Date, ::DateTime, ::Time), val: T.any(::Date, ::DateTime, ::Time)).returns(::String) }
def early_error_message(earliest, val); end
# Build the error message for a given error
#
# source://data_model//lib/data_model/errors.rb#233
sig { params(error: [::Symbol, ::Object]).returns(::String) }
def error_message(error); end
# Get the error message builders
#
# source://data_model//lib/data_model/errors.rb#167
sig { returns(T::Hash[::Symbol, T.proc.params(ctx: T.untyped).returns(::String)]) }
def error_message_builders; end
# TODO: separate builders from other use cases for this mixin
# Build error messages from error object
#
# source://data_model//lib/data_model/errors.rb#249
sig { params(error: ::DataModel::Error).returns(T::Hash[::Symbol, T::Array[::String]]) }
def error_messages(error); end
# Exclusive error applies when a value is in a set of disallowed values
#
# source://data_model//lib/data_model/errors.rb#39
sig { params(set: T::Array[T.any(::String, ::Symbol)]).returns([::Symbol, ::Object]) }
def exclusion_error(set); end
# Generate a message for an exclusion error
#
# source://data_model//lib/data_model/errors.rb#107
sig { params(set: T::Array[::Symbol]).returns(::String) }
def exclusion_error_message(set); end
# Extra keys error applies when a hash has extra keys
#
# source://data_model//lib/data_model/errors.rb#51
sig { params(keys: T::Array[::Symbol]).returns([::Symbol, ::Object]) }
def extra_keys_error(keys); end
# Generate a message for an extra keys error
#
# source://data_model//lib/data_model/errors.rb#119
sig { params(keys: T::Array[::Symbol]).returns(::String) }
def extra_keys_error_message(keys); end
# Inclusion error applies when a value is not in a set of allowed values
#
# source://data_model//lib/data_model/errors.rb#33
sig { params(set: T::Array[T.any(::String, ::Symbol)]).returns([::Symbol, ::Object]) }
def inclusion_error(set); end
# Generate a message for an inclusion error
#
# source://data_model//lib/data_model/errors.rb#101
sig { params(set: T::Array[::Symbol]).returns(::String) }
def inclusion_error_message(set); end
# Generate a message for a value that occurs later then the specified latest point
#
# source://data_model//lib/data_model/errors.rb#143
sig { params(latest: T.any(::Date, ::DateTime, ::Time), val: T.any(::Date, ::DateTime, ::Time)).returns(::String) }
def late_error_message(latest, val); end
# Latest applies when value is earlier then earliest
#
# source://data_model//lib/data_model/errors.rb#75
sig do
params(
latest: T.any(::Date, ::DateTime, ::Time),
val: T.any(::Date, ::DateTime, ::Time)
).returns([::Symbol, ::Object])
end
def latest_error(latest, val); end
# Max applies when value is less then the minimum
#
# source://data_model//lib/data_model/errors.rb#63
sig { params(min: ::Numeric, val: ::Numeric).returns([::Symbol, ::Object]) }
def max_error(min, val); end
# Generate a message for a min error
#
# source://data_model//lib/data_model/errors.rb#131
sig { params(max: ::Numeric, val: ::Numeric).returns(::String) }
def max_error_message(max, val); end
# Min applies when value is less then the minimum
#
# source://data_model//lib/data_model/errors.rb#57
sig { params(min: ::Numeric, val: ::Numeric).returns([::Symbol, ::Object]) }
def min_error(min, val); end
# Generate a message for a min error
#
# source://data_model//lib/data_model/errors.rb#125
sig { params(min: ::Numeric, val: ::Numeric).returns(::String) }
def min_error_message(min, val); end
# Missing error applies when a value is missing
#
# source://data_model//lib/data_model/errors.rb#27
sig { params(cls: T.class_of(Object)).returns([::Symbol, ::Object]) }
def missing_error(cls); end
# Generate a message for a missing error
#
# source://data_model//lib/data_model/errors.rb#95
sig { params(cls: T.class_of(Object)).returns(::String) }
def missing_error_message(cls); end
# Register a custom error message for use with custom errors
#
# source://data_model//lib/data_model/errors.rb#154
sig { params(type: ::Symbol, block: T.proc.params(ctx: T.untyped).returns(::String)).void }
def register_error_message(type, &block); end
# source://data_model//lib/data_model/errors.rb#256
sig { params(error: ::DataModel::Error, from: T.class_of(Object), to: T.class_of(Object)).void }
def set_error_class(error, from, to); end
# Type error applies when a value is not of the expected type
#
# source://data_model//lib/data_model/errors.rb#15
sig { params(cls: T.class_of(Object), value: ::Object).returns([::Symbol, ::Object]) }
def type_error(cls, value); end
# Generate a message for a type error
#
# source://data_model//lib/data_model/errors.rb#83
sig { params(cls: T.class_of(Object), value: ::Object).returns(::String) }
def type_error_message(cls, value); end
end
# source://data_model//lib/data_model/errors.rb#160
DataModel::Errors::TClassCtx = T.type_alias { T.class_of(Object) }
# source://data_model//lib/data_model/errors.rb#159
DataModel::Errors::TClassValueCtx = T.type_alias { [T.class_of(Object), ::Object] }
# API
# TODO: split this file
#
# source://data_model//lib/data_model/errors.rb#150
DataModel::Errors::TErrorMessageBuilder = T.type_alias { T.proc.params(ctx: T.untyped).returns(::String) }
# source://data_model//lib/data_model/errors.rb#158
DataModel::Errors::TErrorMessages = T.type_alias { T::Hash[::Symbol, T.proc.params(ctx: T.untyped).returns(::String)] }
# source://data_model//lib/data_model/errors.rb#161
DataModel::Errors::TSetCtx = T.type_alias { T::Array[::Symbol] }
# source://data_model//lib/data_model/errors.rb#9
DataModel::Errors::TTemporal = T.type_alias { T.any(::Date, ::DateTime, ::Time) }
# source://data_model//lib/data_model/errors.rb#162
DataModel::Errors::TWithinCtx = T.type_alias { [::Numeric, ::Numeric] }
# source://data_model//lib/data_model/errors.rb#163
DataModel::Errors::TWithinTemporalCtx = T.type_alias { [T.any(::Date, ::DateTime, ::Time), T.any(::Date, ::DateTime, ::Time)] }
module DataModel::Fixtures; end
# source://data_model//lib/data_model/fixtures/array.rb#4
module DataModel::Fixtures::Array
include ::DataModel::Fixtures
extend ::DataModel::Fixtures
extend ::DataModel::Fixtures::Array
# source://data_model//lib/data_model/fixtures/array.rb#51
sig { returns(::DataModel::Fixtures::Example) }
def array_optional_string; end
# source://data_model//lib/data_model/fixtures/array.rb#40
sig { returns(::DataModel::Fixtures::Example) }
def optional_string_array; end
# source://data_model//lib/data_model/fixtures/array.rb#10
sig { returns(::DataModel::Fixtures::Example) }
def string_array; end
# source://data_model//lib/data_model/fixtures/array.rb#25
sig { returns(::DataModel::Fixtures::Example) }
def wrapping_string_array; end
end
# source://data_model//lib/data_model/fixtures/big_decimal.rb#6
module DataModel::Fixtures::BigDecimal
include ::DataModel::Fixtures
extend ::DataModel::Fixtures
extend ::DataModel::Fixtures::BigDecimal
# source://data_model//lib/data_model/fixtures/big_decimal.rb#45
sig { returns(::DataModel::Fixtures::Example) }
def max; end
# source://data_model//lib/data_model/fixtures/big_decimal.rb#34
sig { returns(::DataModel::Fixtures::Example) }
def min; end
# source://data_model//lib/data_model/fixtures/big_decimal.rb#24
sig { returns(::DataModel::Fixtures::Example) }
def optional; end
# source://data_model//lib/data_model/fixtures/big_decimal.rb#12
sig { returns(::DataModel::Fixtures::Example) }
def simple; end
end
# source://data_model//lib/data_model/fixtures/boolean.rb#4
module DataModel::Fixtures::Boolean
include ::DataModel::Fixtures
extend ::DataModel::Fixtures
extend ::DataModel::Fixtures::Boolean
# source://data_model//lib/data_model/fixtures/boolean.rb#23
sig { returns(::DataModel::Fixtures::Example) }
def optional; end
# source://data_model//lib/data_model/fixtures/boolean.rb#10
sig { returns(::DataModel::Fixtures::Example) }
def simple; end
end
# source://data_model//lib/data_model/fixtures/date.rb#4
module DataModel::Fixtures::Date
include ::DataModel::Fixtures
extend ::DataModel::Fixtures
extend ::DataModel::Fixtures::Date
# source://data_model//lib/data_model/fixtures/date.rb#44
sig { returns(::DataModel::Fixtures::Example) }
def earliest; end
# source://data_model//lib/data_model/fixtures/date.rb#10
sig { returns(::Date) }
def earliest_date; end
# source://data_model//lib/data_model/fixtures/date.rb#49
sig { returns(::DataModel::Fixtures::Example) }
def latest; end
# source://data_model//lib/data_model/fixtures/date.rb#15
sig { returns(::Date) }
def latest_date; end
# source://data_model//lib/data_model/fixtures/date.rb#39
sig { returns(::DataModel::Fixtures::Example) }
def optional; end
# source://data_model//lib/data_model/fixtures/date.rb#34
sig { returns(::DataModel::Fixtures::Example) }
def simple; end
# source://data_model//lib/data_model/fixtures/date.rb#20
sig { returns(T::Hash[::DataModel::Fixtures::Symbol, ::Object]) }
def variants; end
end
# source://data_model//lib/data_model/fixtures/example.rb#4
class DataModel::Fixtures::Example
# source://data_model//lib/data_model/fixtures/example.rb#8
sig { params(schema: T::Array[::Object], variants: T::Hash[::Symbol, ::Object]).void }
def initialize(schema, variants:); end
# source://data_model//lib/data_model/fixtures/example.rb#19
sig { params(type: ::Symbol).returns([::DataModel::Model, ::Object]) }
def [](type); end
# source://data_model//lib/data_model/fixtures/example.rb#14
sig { returns(::DataModel::Model) }
def model; end
end
# source://data_model//lib/data_model/fixtures/float.rb#4
module DataModel::Fixtures::Float
include ::DataModel::Fixtures
extend ::DataModel::Fixtures
extend ::DataModel::Fixtures::Float
# source://data_model//lib/data_model/fixtures/float.rb#43
sig { returns(::DataModel::Fixtures::Example) }
def max; end
# source://data_model//lib/data_model/fixtures/float.rb#32
sig { returns(::DataModel::Fixtures::Example) }
def min; end
# source://data_model//lib/data_model/fixtures/float.rb#22
sig { returns(::DataModel::Fixtures::Example) }
def optional; end
# source://data_model//lib/data_model/fixtures/float.rb#10
sig { returns(::DataModel::Fixtures::Example) }
def simple; end
end
# source://data_model//lib/data_model/fixtures/hash.rb#4
module DataModel::Fixtures::Hash
include ::DataModel::Fixtures
extend ::DataModel::Fixtures
extend ::DataModel::Fixtures::Hash
# source://data_model//lib/data_model/fixtures/hash.rb#53
sig { returns(::DataModel::Fixtures::Example) }
def closed_contact; end
# source://data_model//lib/data_model/fixtures/hash.rb#21
sig { returns(::DataModel::Fixtures::Example) }
def contact; end
# source://data_model//lib/data_model/fixtures/hash.rb#12
sig { returns(T::Hash[::DataModel::Fixtures::Symbol, T.untyped]) }
def example_contact; end
# source://data_model//lib/data_model/fixtures/hash.rb#39
sig { returns(::DataModel::Fixtures::Example) }
def optional_contact; end
end
# source://data_model//lib/data_model/fixtures/hash.rb#9
DataModel::Fixtures::Hash::TContact = T.type_alias { T::Hash[::DataModel::Fixtures::Symbol, T.untyped] }
# source://data_model//lib/data_model/fixtures/integer.rb#4
module DataModel::Fixtures::Integer
include ::DataModel::Fixtures
extend ::DataModel::Fixtures
extend ::DataModel::Fixtures::Integer
# source://data_model//lib/data_model/fixtures/integer.rb#43
sig { returns(::DataModel::Fixtures::Example) }
def max; end
# source://data_model//lib/data_model/fixtures/integer.rb#32
sig { returns(::DataModel::Fixtures::Example) }
def min; end
# source://data_model//lib/data_model/fixtures/integer.rb#22
sig { returns(::DataModel::Fixtures::Example) }
def optional; end
# source://data_model//lib/data_model/fixtures/integer.rb#10
sig { returns(::DataModel::Fixtures::Example) }
def simple; end
end
# source://data_model//lib/data_model/fixtures/string.rb#4
module DataModel::Fixtures::String
include ::DataModel::Fixtures
extend ::DataModel::Fixtures
extend ::DataModel::Fixtures::String
# source://data_model//lib/data_model/fixtures/string.rb#56
sig { returns(::DataModel::Fixtures::Example) }
def allow_blank; end
# source://data_model//lib/data_model/fixtures/string.rb#68
sig { returns(::DataModel::Fixtures::Example) }
def dont_allow_blank; end
# source://data_model//lib/data_model/fixtures/string.rb#45
sig { returns(::DataModel::Fixtures::Example) }
def exclusion; end
# source://data_model//lib/data_model/fixtures/string.rb#34
sig { returns(::DataModel::Fixtures::Example) }
def inclusion; end
# source://data_model//lib/data_model/fixtures/string.rb#22
sig { returns(::DataModel::Fixtures::Example) }
def optional; end
# source://data_model//lib/data_model/fixtures/string.rb#10
sig { returns(::DataModel::Fixtures::Example) }
def simple; end
end
# source://data_model//lib/data_model/fixtures/symbol.rb#4
module DataModel::Fixtures::Symbol
include ::DataModel::Fixtures
extend ::DataModel::Fixtures
extend ::DataModel::Fixtures::Symbol
# source://data_model//lib/data_model/fixtures/symbol.rb#46
sig { returns(::DataModel::Fixtures::Example) }
def exclusion; end
# source://data_model//lib/data_model/fixtures/symbol.rb#35
sig { returns(::DataModel::Fixtures::Example) }
def inclusion; end
# source://data_model//lib/data_model/fixtures/symbol.rb#23
sig { returns(::DataModel::Fixtures::Example) }
def optional; end
# source://data_model//lib/data_model/fixtures/symbol.rb#10
sig { returns(::DataModel::Fixtures::Example) }
def simple; end
end
# source://data_model//lib/data_model/fixtures/time.rb#4
module DataModel::Fixtures::Time
include ::DataModel::Fixtures
extend ::DataModel::Fixtures
extend ::DataModel::Fixtures::Time
# source://data_model//lib/data_model/fixtures/time.rb#44
sig { returns(::DataModel::Fixtures::Example) }
def earliest; end
# source://data_model//lib/data_model/fixtures/time.rb#10
sig { returns(::Time) }
def earliest_time; end
# source://data_model//lib/data_model/fixtures/time.rb#49
sig { returns(::DataModel::Fixtures::Example) }
def latest; end
# source://data_model//lib/data_model/fixtures/time.rb#15
sig { returns(::Time) }
def latest_time; end
# source://data_model//lib/data_model/fixtures/time.rb#39
sig { returns(::DataModel::Fixtures::Example) }
def optional; end
# source://data_model//lib/data_model/fixtures/time.rb#34
sig { returns(::DataModel::Fixtures::Example) }
def simple; end
# source://data_model//lib/data_model/fixtures/time.rb#20
sig { returns(T::Hash[::DataModel::Fixtures::Symbol, ::Object]) }
def variants; end
end
# source://data_model//lib/data_model/logging.rb#6
module DataModel::Logging
# source://data_model//lib/data_model/logging.rb#11
sig { returns(::Logger) }
def log; end
end
# source://data_model//lib/data_model/model.rb#4
class DataModel::Model
# source://data_model//lib/data_model/model.rb#8
sig { params(schema: T::Array[::Object], type: ::DataModel::Type).void }
def initialize(schema, type); end
# Read data with the model. This will return a tuple of [data, error]
#
# source://data_model//lib/data_model/model.rb#26
sig { params(data: ::Object).returns([::Object, ::DataModel::Error]) }
def coerce(data); end
# source://data_model//lib/data_model/model.rb#14
sig { returns(T::Array[::Object]) }
def schema; end
# Validate data against the model. This will return true if the data is valid,
# or false if it is not. If it is not valid, it will raise an exception.
#
# source://data_model//lib/data_model/model.rb#19
sig { params(data: ::Object).returns(::DataModel::Error) }
def validate(data); end
end
# source://data_model//lib/data_model/scanner.rb#20
module DataModel::Scanner
include ::DataModel::Logging
extend ::DataModel::Logging
extend ::DataModel::Scanner
# Scan a schema, which is defined as a data structure, into a struct that is easier to work with.
# "Syntax" validations will be enforced at this level.
#
# source://data_model//lib/data_model/scanner.rb#36
sig { params(schema: T::Array[::Object], registry: ::DataModel::TypeRegistry).returns(::DataModel::Scanner::Node) }
def scan(schema, registry = T.unsafe(nil)); end
end
# source://data_model//lib/data_model/scanner.rb#27
class DataModel::Scanner::Node < ::T::Struct
prop :type, ::Symbol, default: T.unsafe(nil)
prop :args, T::Hash[::Symbol, ::Object], default: T.unsafe(nil)
prop :params, T::Array[::Object], default: T.unsafe(nil)
class << self
# source://sorbet-runtime/0.5.10810/lib/types/struct.rb#13
def inherited(s); end
end
end
# source://data_model//lib/data_model.rb#20
DataModel::TData = T.type_alias { ::Object }
# an error is a tuple of [error_type, error_context], where context
# provides additional information about the error
#
# source://data_model//lib/data_model.rb#24
DataModel::TError = T.type_alias { [::Symbol, ::Object] }
# source://data_model//lib/data_model.rb#19
DataModel::TSchema = T.type_alias { T::Array[::Object] }
# a map of symbol => type, suitable for sending to a TypeRegistry
#
# source://data_model//lib/data_model.rb#27
DataModel::TTypeMap = T.type_alias { T::Hash[::Symbol, T.class_of(DataModel::Type)] }
# source://data_model//lib/data_model/testing.rb#4
module DataModel::Testing; end
# source://data_model//lib/data_model/testing/minitest.rb#6
module DataModel::Testing::Minitest
include ::Minitest::Assertions
# source://data_model//lib/data_model/testing/minitest.rb#12
sig { params(err: ::DataModel::Error, type: ::Symbol, key: T.nilable(::Symbol)).void }
def assert_child_model_error(err, type, key = T.unsafe(nil)); end
# source://data_model//lib/data_model/testing/minitest.rb#22
sig { params(err: ::DataModel::Error, type: ::Symbol).void }
def assert_model_error(err, type); end
# source://data_model//lib/data_model/testing/minitest.rb#64
sig { params(err: ::DataModel::Error, type: T.nilable(::Symbol)).void }
def refute_all_errors(err, type = T.unsafe(nil)); end
# source://data_model//lib/data_model/testing/minitest.rb#31
sig { params(err: ::DataModel::Error, type: T.nilable(::Symbol), key: T.nilable(::Symbol)).void }
def refute_child_model_error(err, type = T.unsafe(nil), key = T.unsafe(nil)); end
# source://data_model//lib/data_model/testing/minitest.rb#48
sig { params(err: ::DataModel::Error, type: T.nilable(::Symbol)).void }
def refute_model_error(err, type = T.unsafe(nil)); end
end
# @abstract It cannot be directly instantiated. Subclasses must implement the `abstract` methods below.
#
# source://data_model//lib/data_model/type.rb#5
class DataModel::Type
abstract!
# source://data_model//lib/data_model/type.rb#16
sig { params(args: T::Hash[::Symbol, T.untyped], registry: ::DataModel::TypeRegistry).void }
def initialize(args, registry: T.unsafe(nil)); end
# configure must be overridden to use params
#
# source://data_model//lib/data_model/type.rb#26
sig { overridable.params(params: T::Array[::Object]).void }
def configure(params); end
# instanciate another type
#
# source://data_model//lib/data_model/type.rb#40
sig do
params(
name: ::Symbol,
args: T::Hash[::Symbol, T.untyped],
params: T.nilable(T::Array[::Object])
).returns(::DataModel::Type)
end
def instantiate(name, args: T.unsafe(nil), params: T.unsafe(nil)); end
# invoke another type by name
#
# source://data_model//lib/data_model/type.rb#30
sig do
params(
name: ::Symbol,
val: ::Object,
coerce: T::Boolean,
args: T::Hash[::Symbol, T.untyped],
params: T.nilable(T::Array[::Object])
).returns([::Object, ::DataModel::Error])
end
def invoke(name, val, coerce: T.unsafe(nil), args: T.unsafe(nil), params: T.unsafe(nil)); end
# default reader
#
# @abstract
#
# source://data_model//lib/data_model/type.rb#48
sig { abstract.params(data: ::Object, coerce: T::Boolean).returns([::Object, ::DataModel::Error]) }
def read(data, coerce: T.unsafe(nil)); end
# source://data_model//lib/data_model/type.rb#22
sig { returns(T::Hash[::Symbol, T.untyped]) }
def type_args; end
class << self
# source://sorbet-runtime/0.5.10810/lib/types/private/abstract/declare.rb#37
def new(*args, **_arg1, &blk); end
end
end
# source://data_model//lib/data_model/type.rb#11
DataModel::Type::TArguments = T.type_alias { T::Hash[::Symbol, T.untyped] }
# source://data_model//lib/data_model/type.rb#12
DataModel::Type::TTypeParams = T.type_alias { T::Array[::Object] }
# source://data_model//lib/data_model/type.rb#13
DataModel::Type::TTypeResult = T.type_alias { [::Object, ::DataModel::Error] }
# TypeRegistry allows for different type implementations to be used by the scanner.
# It also acts as an error message registry, mostly for pragmatic reasons.
#
# source://data_model//lib/data_model/type_registry.rb#6
class DataModel::TypeRegistry
include ::DataModel::Errors
# Instanciate a new type registry. Default errors will always be used, but additional
# errors can be registered.
#
# source://data_model//lib/data_model/type_registry.rb#31
sig do
params(
types: T::Hash[::Symbol, T.class_of(DataModel::Type)],
errors: T.nilable(T::Hash[::Symbol, T.proc.params(ctx: T.untyped).returns(::String)])
).void
end
def initialize(types: T.unsafe(nil), errors: T.unsafe(nil)); end
# Register a type on this instance
#
# source://data_model//lib/data_model/type_registry.rb#42
sig { params(name: ::Symbol, type: T.class_of(DataModel::Type)).void }
def register(name, type); end
# Access and configure registered type
#
# source://data_model//lib/data_model/type_registry.rb#54
sig do
params(
name: ::Symbol,
args: T::Hash[::Symbol, T.untyped],
params: T.nilable(T::Array[::Object])
).returns(::DataModel::Type)
end
def type(name, args: T.unsafe(nil), params: T.unsafe(nil)); end
# Check if a type is registered
#
# source://data_model//lib/data_model/type_registry.rb#48
sig { params(name: ::Symbol).returns(T::Boolean) }
def type?(name); end
class << self
# Default types that will be used if alternative type map is not given
#
# source://data_model//lib/data_model/type_registry.rb#12
sig { returns(T::Hash[::Symbol, T.class_of(DataModel::Type)]) }
def default_types; end
# Singleton instance that will be used globally unless instances given
#
# source://data_model//lib/data_model/type_registry.rb#18
sig do
params(
types: T::Hash[::Symbol, T.class_of(DataModel::Type)],
errors: T.nilable(T::Hash[::Symbol, T.proc.params(ctx: T.untyped).returns(::String)])
).returns(::DataModel::TypeRegistry)
end
def instance(types: T.unsafe(nil), errors: T.unsafe(nil)); end
# Register a type on the global instance
#
# source://data_model//lib/data_model/type_registry.rb#24
sig { params(name: ::Symbol, type: T.class_of(DataModel::Type)).void }
def register(name, type); end
end
end
# source://data_model//lib/data_model/version.rb#4
DataModel::VERSION = T.let(T.unsafe(nil), String)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment