We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I think a patch as small as this could work:
diff --git a/src/crystalizer.cr b/src/crystalizer.cr index 03989e3..397c66a 100644 --- a/src/crystalizer.cr +++ b/src/crystalizer.cr @@ -7,7 +7,7 @@ module Crystalizer protected def self.each_ivar(object : O, &) forall O {% for ivar in O.instance_vars %} {% ann = ivar.annotation(::Crystalizer::Field) %} - {% unless ann && ann[:ignore] %} + {% unless ann && (ann[:ignore] || ann[:ignore_serialize])%} {% key = ((ann && ann[:key]) || ivar).id.stringify %} yield {{key}}, object.@{{ivar}}, Variable.new( type: {{ivar.type}}, diff --git a/src/deserializer/non_self_describing_object.cr b/src/deserializer/non_self_describing_object.cr index 3694fb2..9721beb 100644 --- a/src/deserializer/non_self_describing_object.cr +++ b/src/deserializer/non_self_describing_object.cr @@ -15,7 +15,7 @@ struct Crystalizer::Deserializer::NonSelfDescribingObject(T) def set_each_ivar(&) {% for ivar in T.instance_vars %} {% ann = ivar.annotation(::Crystalizer::Field) %} - {% unless ann && ann[:ignore] %} + {% unless ann && (ann[:ignore] || ann[:ignore_deserialize])%} {% key = ((ann && ann[:key]) || ivar).id.stringify %} variable = Variable.new( type: {{ivar.type}}, diff --git a/src/deserializer/self_describing_object.cr b/src/deserializer/self_describing_object.cr index 60f5719..1994dff 100644 --- a/src/deserializer/self_describing_object.cr +++ b/src/deserializer/self_describing_object.cr @@ -16,7 +16,7 @@ struct Crystalizer::Deserializer::SelfDescribingObject(T, N) case key {% for ivar in T.instance_vars %} {% ann = ivar.annotation(::Crystalizer::Field) %} - {% unless ann && ann[:ignore] %} + {% unless ann && (ann[:ignore] || ann[:ignore_deserialize]) %} {% key = ((ann && ann[:key]) || ivar).id.stringify %} when {{key}} raise Error.new "Duplicated field for {{T}}: #{key}" if @found[{{i}}] @@ -41,7 +41,7 @@ struct Crystalizer::Deserializer::SelfDescribingObject(T, N) {% i = 0 %} {% for ivar in T.instance_vars %} {% ann = ivar.annotation(::Crystalizer::Field) %} - {% unless ann && ann[:ignore] %} + {% unless ann && (ann[:ignore] || (ann[:ignore_serialize] && ann[:ignore_deserialize])) %} if !@found[{{i}}] {% if ivar.has_default_value? %} pointerof(@object_instance.@{{ivar}}).value = {{ivar.default_value}}
The text was updated successfully, but these errors were encountered:
f673349
No branches or pull requests
I think a patch as small as this could work:
The text was updated successfully, but these errors were encountered: