annotation Athena::Serializer::Annotations::IgnoreOnSerialize

Overview

Indicates that a property should be set on deserialization, but should not be serialized.

Example

class Example
  include ASR::Serializable

  property name : String

  @[ASRA::IgnoreOnSerialize]
  property password : String?
end

obj = ASR.serializer.deserialize Example, %({"name":"Jim","password":"monkey123"}), :json

obj.password # => monkey123
obj.name     # => Jim

obj.password = "foobar"

ASR.serializer.serialize obj, :json # => {"name":"Jim"}

Defined in:

annotations.cr