Replies: 2 comments 1 reply
-
@tatewake have you looked into the the |
Beta Was this translation helpful? Give feedback.
0 replies
-
Ah, I have not, I'll look into it. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Is your feature request related to a problem? Please describe.
In my scenario, I need to assign default values during decoding if certain fields are missing (which is already supported), but I also want to avoid encoding a field if its value matches the same default.
Consider this
Node
struct:For example, if
center
isn't set, it should default to.zero
during decoding. Similarly, for my use case, if it's already set to.zero
, there's no need to encode it since it's the expected default.Describe the solution you'd like
Introduce a new tag, perhaps something like
@IgnoreEncodingIfDefault
when set alongside@Default(CGPoint.zero)
or a standalone@IgnoreEncodingDefault(CGPoint.zero)
for this purpose. (I'm not certain what the best naming convention would be, I'd imagine you'd have better ideas.)I feel this feature would be particularly useful for user-editable configuration files where we would want to omit any "optional" fields, or just keeping human-readable configurations minimal for git diffing.
Beta Was this translation helpful? Give feedback.
All reactions