Add a feature to allow any json in a variant#55
Conversation
|
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. |
anmonteiro
left a comment
There was a problem hiding this comment.
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 ? |
|
Could this be merged ? I don't have right to do so @anmonteiro |
|
We should still snapshot the tests that are failing before merging |
|
Yeah. The failures are not reproduced on my machine, so I am not sure how to do it. |
|
This seems to be the difference in ocamlformat versions installed on CI vs local. |
|
There should be a .ocamlformat file with a fixed version to avoid that. |
|
There is a test that is failing or succeeding depending on the version. I think this one is impossible to promote. Should I try and fix or is this good enough ? |
As a bonus : imrpove of the last two unhelpful error message
|
hey @EmileTrotignon, I just pushed a commit fixing this test so that we can promote it for all ocaml versions. |
|
This is ready for merging |
* main: Add a feature to allow any json in a variant (#55)
Syntax is as follow :
Then, if the json
jis invalid fortype t,Other jis 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.tin Js andYojson.Basic.tin 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.