|
|
|
|
|
by andyferris
1122 days ago
|
|
I was wondering if you've considered having an alternative, human readable encoding (either your own syntax or a JSON-based schema)? I find it quite useful to be able to inspect data by eye and even hand-editing payloads occassionally, and having a standard syntax for doing so would be nice. (More generally, it's a shame JSON doesn't support sum types "natively" and I think a human readable format with Typical's data model would be really cool). |
|
1) For Rust, the generated types implement the `Debug` trait, so they can be printed in a textual format that Rust programmers are accustomed to reading.
2) For JavaScript/TypeScript, deserialized messages are simple passive data objects that can be logged or inspected in the developer console.
So it's easy to log/inspect deserialized messages in a human-readable format, but there's currently no way to read/edit encoded messages directly. In the future, we may add an option to encode messages as JSON which would match the representation currently used for decoded messages in JavaScript/TypeScript, with sums being encoded as tagged unions.