3 ms·
> In other words, there is still a (lossy) translation layer, it just happens to be in the RDBMS rather than in-app. It's not lossy if your application can gua
by nextaccountic 3y ago
> In other words, there is still a (lossy) translation layer, it just happens to be in the RDBMS rather than in-app.
It's not lossy if your application can guarantee a json <-> datatype roundtrip and the json is validated with jsonschema (generated by your application)
In Rust it's something like this
https://serde.rs/ https://serde.rs/ to do the data type <-> json mapping
https://docs.rs/schemars/latest/schemars/ https://docs.rs/schemars/latest/schemars/ to generate jsonschema from your types
https://github.com/supabase/pg_jsonschema https://github.com/supabase/pg_jsonschema to validate jsonschema in your database (postgres). with this setup it's interesting (but not required) to also use https://docs.rs/jsonschema/latest/jsonschema/ https://docs.rs/jsonschema/latest/jsonschema/ to validate the schema in your application