-
Notifications
You must be signed in to change notification settings - Fork 3
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
Add a feature to allow any json in a variant #55
base: main
Are you sure you want to change the base?
Conversation
As a bonus : imrpove of the last two unhelpful error message
I also moved the common folder inside the native one. The reason for that is that then I can use it with using |
Something similar exists in atdgen, it only allows extra tags instead of any json. I think allowing any json is a good idea, especially because we have structured types for json so we can easily check afterward if its tag-shapped. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this makes sense, no strong opinions
Hey @anmonteiro I have added the label you asked, and remove the stray comment. Any other change required ? |
Syntax is as follow :
Then, if the json
j
is invalid fortype t
,Other j
is returned instead.There is support for both runtime and js (although their Json type is different: is that an issue ? We could introduce a
[%json]
extension that translates toJs.Json.t
in Js andYojson.Basic.t
in runtime if its an issue.)As a bonus, I improved an error message that slipped through in my error message PR. Because its only on JS I did not find it with my cram tests.