Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't access primitives in v0.16.0 #18

Open
yongrenjie opened this issue Jun 15, 2023 · 2 comments
Open

Can't access primitives in v0.16.0 #18

yongrenjie opened this issue Jun 15, 2023 · 2 comments
Labels
forwarded-to-js-devs This report has been forwarded to Jane Street's internal review system.

Comments

@yongrenjie
Copy link

Since upgrading to v0.16.0 (released yesterday on OPAM), primitives such as int_of_yojson aren't visible. (Downgrading to v0.15.1 works!)

Minimal working example:

type t = {
  id: int;
}
[@@deriving of_yojson]

let () =
  let json = "{\"id\": 1}" in
  let t = t_of_yojson (Yojson.Safe.from_string json) in
  Printf.printf "id is: %d\n" t.id

Error:

File "bin/main.ml", line 2, characters 6-9:
2 |   id: int;
          ^^^
Error: Unbound value int_of_yojson
@github-iron github-iron added the forwarded-to-js-devs This report has been forwarded to Jane Street's internal review system. label Jun 16, 2023
@W95Psp
Copy link

W95Psp commented Jun 18, 2023

I have the same issue, but looking at commit 6a0456d, this breaking change seems intentional. The solution is thus to add an explicit open Ppx_yojson_conv_lib.Yojson_conv.Primitives. I guess this change was made because a PPX cannot distinguish between i.e. a user-defined option and OCaml's option...

@Lupus
Copy link

Lupus commented Dec 6, 2024

Can this be added into README? I have to lookup this library name in other projects where I have figured it out already. Would be awesome to have minimal set of steps to get one going with this ppx right in README...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
forwarded-to-js-devs This report has been forwarded to Jane Street's internal review system.
Projects
None yet
Development

No branches or pull requests

4 participants