-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix when omitempties(T) = true is defined in StructTypes.foreachfield (…
…#50) I noticed in some serialized JSON from JSON3.jl recently that some fields were still getting serialized when I had defined `StructTypes.omitempties(::Type{MyType}) = true`, which is a shorthand we introduced when you want to omit empty values for any field in a type. Unfortunately, we failed to update `StructTypes.foreachfield` to respect this option and double unfortunately, the code still happened to "work", i.e. not throw an error whether `omitempties` returned a `Bool` or `Tuple`. The fix is pretty simple: if `omitempties` returns `true`, then we query the `fieldnames` of the struct.
- Loading branch information
Showing
2 changed files
with
17 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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