KitApps / schema-refined

Clojure library to keep you away from bugs with precise schemas (refined types with runtime checks)
MIT License
67 stars 2 forks source link

[discussion] Flexible serialization/deserialization for types and predicates #21

Open kachayev opened 6 years ago

kachayev commented 6 years ago

A few use cases that I have on my mind:

  1. To send type definitions from the server to the client or from one server to another one. That's pretty simple if we're talking about Clojure ↔ Clojure communication, but what I want to archive here... do not restrict implementation, so you can plug-in your own handlers for each type/predicate (or maybe to cover only those which you're interested in).

  2. Generate serialization formats from type/predicate definition, skipping "unknowns". E.g. protobuf, thrift, JSON schema, avro, parquet, SQL tables schema etc. Note, that each format has own restrictions and own ways to handle different predicates (like, bounded size for the string might be used in SQL but has no meaning in protobuf).

  3. Write special schema headers for files that do not support schemas (like CSV), so the client is able to pick the best memory layout using those.