I am migrating to the latest versions on opam (atdgen.2.0.0 and yojson.1.6.0). I have untyped json in parts of my ATD definitions. The following definition now raises warnings:
bash-3.2$ cat test_json.atd
type json <ocaml module="Yojson.Basic" t="json"> = abstract
<doc text="Type of arbitrary JSON values.">
bash-3.2$ ocamlfind ocamlc -c test_json_j.mli -package atdgen
File "test_json_j.mli", line 5, characters 12-29:
Warning 3: deprecated: Yojson.Basic.json
json types are being renamed and will be removed in the next Yojson major version. Use type t instead
bash-3.2$ ocamlfind ocamlc -c test_json_j.ml -package atdgen
File "test_json_j.ml", line 5, characters 12-29:
Warning 3: deprecated: Yojson.Basic.json
json types are being renamed and will be removed in the next Yojson major version. Use type t instead
Switching to t instead of json doesn't seem to help:
bash-3.2$ cat test_t.atd
type json <ocaml module="Yojson.Basic" t="t"> = abstract
<doc text="Type of arbitrary JSON values.">
bash-3.2$ atdgen -j -j-std test_t.atd
bash-3.2$ ocamlfind ocamlc -c test_t_j.mli -package atdgen
bash-3.2$ ocamlfind ocamlc -c test_t_j.ml -package atdgen
File "test_t_j.ml", line 8, characters 2-22:
Error: Unbound value Yojson.Basic.write_t
Hint: Did you mean write_int?
I'm wondering if I'm doing the wrong thing, or if it's a mismatch between atd and yojson.
Is there any workaround? What is the correct way to define untyped JSON with the latest version?
I am migrating to the latest versions on opam (atdgen.2.0.0 and yojson.1.6.0). I have untyped json in parts of my ATD definitions. The following definition now raises warnings:
Switching to
tinstead ofjsondoesn't seem to help:I'm wondering if I'm doing the wrong thing, or if it's a mismatch between atd and yojson.
Is there any workaround? What is the correct way to define untyped JSON with the latest version?