Skip to content

Commit

Permalink
Update DataBuilder.hx
Browse files Browse the repository at this point in the history
  • Loading branch information
EliteMasterEric authored and elnabo committed Sep 26, 2023
1 parent 4299861 commit 744ab6b
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions src/json2object/writer/DataBuilder.hx
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,22 @@ class DataBuilder {
}
assignations.push(assignation);

skips.push(
field.meta.has(':optional')
? macro $f_a == null
: macro false
);
if (field.meta.has(':optional')) {
switch (field.type) {
case TAbstract(t, params):
if (t.toString() == "Null") {
// Null<Bool>
skips.push(macro $f_a == null);
} else {
// Bool
skips.push(macro false);
}
default:
skips.push(macro $f_a == null);
}
} else {
skips.push(macro false);
}

default:
}
Expand Down

0 comments on commit 744ab6b

Please sign in to comment.