- strongly typed
- ad-hoc or schema (your choice)
- no code generation step
- edit in text, send in binary
- supports ad-hoc data structures or schemas per your preference
- supports all common types natively (doesn't require special string encoding like base64 or such nonsense)
- supports comments, metadata, references (for recursive/cyclical data), custom types
- doesn't require an extra compilation step or special definition files
- Has parallel binary and textual forms so that you're not wasting CPU and bandwidth serializing/deserializing text. Everything stays in binary except in the rare cases where humans want to look or edit.
https://github.com/lloeki/ruby-skyjam/blob/master/defs/skyja...
gives that:
https://github.com/lloeki/ruby-skyjam/blob/master/lib/skyjam...
I would certainly enjoy having a DSL to write descriptive code to validate using JSON schema, but it would be even better if the Ruby definitions could be generated and persisted in Ruby files using that DSL.
Also, storing things in basic hash/array types works, but having dedicated types is useful, so that one can ensure not shoving one kind of hash in place of another unrelated kind of hash.
As for types themselves in general, there's RBS and Sorbet. One could have type definition generation as well for even deeper static and runtime checks.
It's actually 2020-12, which is two versions after Draft 7 (they shifted from Draft n to YYYY-MM after Draft 7, and since then have had 2019-09 and 2020-12.)
And that's true of most languages, though there is some 2019-09 support. (It really doesn't help that there is also OpenAPI which baked in a variant—“extended subset”—of Draft 5 JSON Schema.)
Existence of a schema definition file and checking responses against is signalling that I can trust an API vendor to be at least aware of the requirements for clients. (Whether they randomly change the schema definition or ignore it is a second question, but at least somebody once thought about formalising and it's not an complete adhoc dump of today's internal data representation)
"Amazon Ion is a richly-typed, self-describing, hierarchical data serialization format offering interchangeable binary and text representations. The text format (a superset of JSON) is easy to read and author, supporting rapid prototyping. The binary representation is efficient to store, transmit, and skip-scan parse. The rich type system provides unambiguous semantics for long-term preservation of data which can survive multiple generations of software evolution."
Apache Avro has support for parsing and utilizing schemas at runtime, even in C++.
For Apache Thrift you have things like thriftpy: https://thriftpy.readthedocs.io/en/latest/
I'm not aware of a type-safe mechanism for Flatbuffers or Protocol Buffers.