Skip to content

handle name attribute in errors correctly #51

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

EmileTrotignon
Copy link
Collaborator

I added better error messages previously, but they ignored the [@name "..."] attribute. Its now correctly taken into account.

I added a test case in errors.t :

  Fatal error: exception Ppx_deriving_json_runtime.Of_json_error(Json_error {|expected ["A"] or ["Foo"] or ["B", _] or ["C", _, _] or ["D", { _ }] or ["different_name"] but got ["B", 123, "booh"]|})

Before this patch this would have been :

  Fatal error: exception Ppx_deriving_json_runtime.Of_json_error(Json_error {|expected ["A"] or ["Foo"] or ["B", _] or ["C", _, _] or ["D", { _ }] or ["Different_name"] but got ["B", 123, "booh"]|})

Copy link
Member

@anmonteiro anmonteiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a small nit, otherwise looks good.

Don't forget to snapshot the tests.

@EmileTrotignon
Copy link
Collaborator Author

just a small nit, otherwise looks good.

Don't forget to snapshot the tests.

What do you mean by snapshotting the tests ?

@anmonteiro
Copy link
Member

What do you mean by snapshotting the tests ?

I mean that there's a significant diff in the cram tests, likely because of OCamlformat versions, but I think that's being taken care of in #55

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants