4 ms·
> This often makes the system brittle to new changes because subsystems have very strict expectations of data schema, even when they don't really need to care a
by mamcx 6y ago
> This often makes the system brittle to new changes because subsystems have very strict expectations of data schema, even when they don't really need to care about i
I deal a lot with this, because I interface with software outside my control. In the case of Rust I find super easy to solve, just use this litte trick:
https://serde.rs/attr-flatten.html https://serde.rs/attr-flatten.html
#[derive(Serialize, Deserialize)]
struct User {
id: String,
username: String,
#[serde(flatten)]
extra: HashMap<String, Value>,
}
Serde is very good. Near all you want is there.
- Dowwie 6y agothis is a great recipe