I need to validate that the structure of a JSON files matches a set of typedefs.
Hugely "inspired" by Compiletime of @jasononeil I'm running a macro at compile time that loads the json content, transforms that into an expression and let's the compiler deal with any type mismatch.
Error reporting changed between Haxe 3.1.3 and 3.2.0
When loading faulty.json
, that has a string where a boolean is expeted for property "b" at line 6
- Haxe 3.2.0 identifies the whole parent object as the source of the problem:
test.json:1: lines 1-13 : Data does not match type: Int should be Null<Bool>
test.json:1: lines 1-13 : Int should be Bool
- Haxe 3.1.3 identifies the actual faulty line as the source of the problem:
test.json:6: characters 5-6 : Data does not match type: Int should be Bool
The reporting of Haxe 3.1.3 would be preferable as more precise of where the error happened.