Closed sethaxen closed 2 years ago
When the same name appears multiple times in a JSON string with values of different structure, @generatetypes fails with an error invalid redefinition of constant. A minimal example:
@generatetypes
invalid redefinition of constant
using JSON3, StructTypes json_string = """ { "label": { "type": "alert", "label": [ { "type": "text", "text": { "content": "Open New" } } ] } } """ JSON3.@generatetypes json_string
ERROR: invalid redefinition of constant Label Stacktrace: [1] top-level scope @ none:1 [2] eval(m::Module, e::Any) @ Core ./boot.jl:373 [3] top-level scope @ REPL[8]:1
I wonder if the second label should named something like Label_2 instead to prevent this case from erroring.
label
Label_2
When the same name appears multiple times in a JSON string with values of different structure,
@generatetypes
fails with an errorinvalid redefinition of constant
. A minimal example:I wonder if the second
label
should named something likeLabel_2
instead to prevent this case from erroring.