rust-italia / dgc

A parser and validator for the EU Digital Green Certificate (dgc) a.k.a. greenpass
https://github.com/rust-italia/dgc
MIT License
26 stars 11 forks source link

Rename all "cryptic" fields into more descriptive names #28

Closed lmammino closed 2 years ago

lmammino commented 2 years ago

We are currently taking a mixed approach to field naming:

I'd like to go for a descriptive approach, leaving to serde the responsability to rename the fields back to their original format in case we want to re-serialise the structs (for instance to JSON).

As an example (suggested by @dodomorandi in #27):

struct x {
    #[serde(skip_serializing_if = "Option::is_none", rename = "fn")]
    pub family_name: Option<String>,
}

In the example above we are deserialising the field fn to family_name (better api for the user) but we tell serde to serialise it back to fn if we have to serialise the struct again (e.g. to JSON).

Since this will be a significant breaking change, I'd like to mark this for 0.1.0. But I suggest it's tackled as part of #6!