Skip to content

annotation Athena::Serializer::Annotations::Exclude #

Indicates that a property should not be serialized/deserialized when used with :none ASRA::ExclusionPolicy.

Also see, ASRA::IgnoreOnDeserialize and ASRA::IgnoreOnSerialize.


class Example
  include ASR::Serializable

  def initialize; end

  property name : String = "Jim"

  property password : String = "monkey"

ASR.serializer.serialize, :json                                          # => {"name":"Jim"}
ASR.serializer.deserialize Example, %({"name":"Jim","password":"password1!"}), :json # => #<Example:0x7f6eec4b6a60 @name="Jim", @password="monkey">

NOTE: On deserialization, the excluded property must be nilable, or have a default value.