Closed Gama11 closed 5 years ago
Even the root is permitted to be null, so schema validation would consider null
as a valid JSON file.
And since 7558e69d609f4b74ec8791493241caf3a2e16caf the generated schema are more null safe.
Hm.. it still feels a bit strange that null
is explicitly suggested for @:optional
fields, for instance here:
Of course it's technically correct since the Haxe counterpart var ?includeProjectFile:Bool;
is implicitly a Null<T>
, but I'd say it's unusual to put an explicit null
value into the JSON, the intention with @:optional
/ ?
is usually to omit it entirely in that case.
Perhaps a distinction should be made between Null<T>
with and without @:optional
?
It's actually worse for String fields since null
is then the only suggestion:
{"type":"null"}
is no longer proposed for @:optional
fields since 55b75880b5bf120a8196421c597f7946ff616dd8.
Nice, that makes it behave much more nicely. :)
It looks like the schema generated for this:
currently permits
null
as a valid value forname
. I think this should only be the case if it's actually explicitly made nullable viaNull<T>
(which@:optional
implies).