class Marten::Schema::Field::JSON

Overview

Represents a JSON schema field.

Defined in:

marten/schema/field.cr
marten/schema/field/json.cr

Constructors

Instance Method Summary

Instance methods inherited from class Marten::Schema::Field::Base

deserialize(value) deserialize, empty_value?(value) : ::Bool empty_value?, id : String id, required? : Bool required?, serialize(value) : ::String | Nil serialize, validate(schema, value) validate

Constructor methods inherited from class Marten::Schema::Field::Base

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

Constructor Detail

def self.new(id : ::String, required : ::Bool = true, serializable : ::JSON::Serializable.class | Nil = nil) #

[View source]

Instance Method Detail

def deserialize(value) : ::JSON::Any | ::JSON::Serializable | Nil #
Description copied from class Marten::Schema::Field::Base

Deserializes a raw field value to the corresponding field value.


[View source]
def serialize(value) : ::String | Nil #
Description copied from class Marten::Schema::Field::Base

Serializes a field value.


[View source]