feat: implement YamlIgnoreCondition handling for serialization and deserialization#9
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request enhances the handling of the
YamlIgnoreattribute in the YAML source generator, allowing for more nuanced control over property serialization and deserialization. The changes introduce support for conditional ignore behaviors (Always,WhenWritingNull,WhenWritingDefault,Never), ensuring that properties are ignored or included according to their specified conditions both when reading and writing YAML.Improvements to YamlIgnore attribute support:
IgnoreConditionenum and refactored logic to interpret theYamlIgnoreattribute, supporting conditional ignore scenarios such asWhenWritingNull,WhenWritingDefault, andNever, in addition toAlways.GetIgnoreCondition,ShouldIgnorePropertyForReading, andGetWriteIgnoreConditionto determine when properties should be ignored during serialization (writing) and deserialization (reading).Serialization logic updates:
GenerateWriteMethodto respect the new ignore conditions when generating serialization code, ensuring properties are skipped appropriately based on theirYamlIgnorecondition. [1] [2] [3]These changes provide more flexible and standards-compliant YAML serialization/deserialization, aligning with modern usage of ignore conditions in serialization libraries.