abstract class Marten::Schema::Field::Base


Abstract base schema field implementation.

Included Modules

Direct Known Subclasses

Defined in:



Instance Method Summary

Macros inherited from module Marten::Template::Object

template_attributes(*names) template_attributes

Constructor Detail

def self.new(id : ::String, required : ::Bool = true) #

[View source]

Instance Method Detail

abstract def deserialize(value) #

Deserializes a raw field value to the corresponding field value.

[View source]
def empty_value?(value) : ::Bool #

Returns true if the value is considered empty by the field.

[View source]
def id : String #

Returns the ID of the field used in the associated schema.

[View source]
def required? : Bool #

Returns a boolean indicating whether the field is required.

[View source]
abstract def serialize(value) : ::String | Nil #

Serializes a field value.

[View source]
def validate(schema, value) #

Runs custom validation logic for a specific schema field and schema object.

This method should be overriden for each field implementation that requires custom validation logic.

[View source]