class

Marten::Schema::Field::Base

Inherits Marten::Template::Object::Auto / Marten::Template::Object / Marten::Template::CanDefineTemplateAttributes / Reference / Object

Abstract base schema field implementation.

Constructors

new(id : ::String, required : ::Bool = true)
Source

Instance methods

deserialize(value)

Deserializes a raw field value to the corresponding field value.

Source
empty_value?(value) : ::Bool

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

Source
get_raw_data(data)

Returns the raw data of the field.

Source
id

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

Source
required?

Returns a boolean indicating whether the field is required.

Source
serialize(value) : ::Array(::String) | Nil | ::String

Serializes a field value.

Source
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.

Source