@Patricia I don’t know if “want” is the right word ;) but there is a standard format for them and they exist for many web APIs
@Patricia and there are tools that can validate JSON against a schema, and in some cases when generate example data from a schema
@Patricia where it gets hairy is that the schemas are often defined in fragments specific to a given API endpoint that then reference (by URI) other schema fragments, and a lot of the automated tools don’t handle this indirection well
@Patricia a couple times I’ve had to write one-off scripts using https://apitools.dev/json-schema-ref-parser/ to patch together a more complete non-hyperlinked schema to feed into other tools that want a single file
@Patricia have you seen this yet? Just stumbled across it today and looks nice https://quicktype.io/
@elfprince13 no I hadn’t, have you tried it?
@Patricia I spent a good chunk of the day debugging 3rd-party code that I think was generated by it, and came away reasonably sure that wasn't the source of the bug I was experiencing
@elfprince13 so good?
@Patricia I think so, from limited perspective of having used its generated code, but not having used it to do the actual code generation myself.
@elfprince13 @Patricia I have a tool I wrote for this to generate C++ code and bindings for the JSON Link library. It happens often enough that schemas are not available but just a web service I can get data from.
@elfprince13 @Patricia The schema's fail to capture relationships like sum types with a tag. And there are like 3 or more ways to express a variant in JSON
@elfprince13 @Patricia One can make JSON much much smaller by using tuples/heterogenous arrays. e.g
["Hello",2,"The","World",true]
@elfprince13 Ok, I want json schemas then?