I'm trying to model write the elasticsearch DSL in ocaml types. frequently, there are things that are well modeled by variants where the tag is a singleton key in an object. For instance on interval queries, we might have a match, a prefix, a wildcard, etc. The DSL represents these like this;
{"match": {...match params}}
{"wildcard": {...wildcard params}}
{"prefix": {...prefix params}}
Writing out the yojson_of_x functions by hand seems like a huge amount of boilerplate, so I'd like to derive them, but ppx_yojson_conv says it represents variants like this;
["match", {...match_params}]
Is there a way to add some other annotation to get it to change its behavior? coming from rust world, serde calls this the "externally tagged" representation, but I don't know if it's possible to configure ppx_yojson_conv in a similar way.