Closed daylinmorgan closed 1 year ago
Certainly not intentional, this is an error.
Error is here:
This portion of the macro creates the branch that is executed when a field name is not mappable. The generated AST looks like this:
when failOnError:
raise constructionError(…)
when ignore
has been set and is empty, this branch is reached with failOnError
being false
, so… nothing happens. This is bad.
Compare what happens when there are explicitly ignored field names and a field is encountered with one of those names:
The fix would be:
else
branch for the when
statement above and call this functionMy Nim is a bit rusty so if you want to tackle this a PR would be very welcome :)
When using the
{.ignore: [].}
pragma to ignore all unknown fields an error is raised if the value is a map.The above fails with
IgnoreMap
and raises:If this is intentional is there a way to specify that nested data should be ignored on an object without knowing the field name?