The generator tries to turn plural into singular nouns.
However, some words turn out badly, including:
- Addresse (from Addresses)
- Prefixe (from Prefixes)
- Bookshelve (from Bookshelves)
- Sery (from Series)
By using a library, we can get a slightly better outcome.
I've added an exception for "Data", because seeing that
turned into "Datum" is a bit jarring.
There were some (breaking) changes in these dependencies and the
required versions changed.
On the bright side, both common crates are now in the 5.0 range.
`add_scope` is simplified to simply add scopes, and no longer takes an `Option<_>` item.
Added `add_scopes` convenience function, which allows adding multiple scopes at once.
Added `clear_scopes` function to explicitly allow clearing method scopes.
Refactor modification of scopes
`add_scope` is simplified to simply add scopes, and no longer takes an `Option<_>` item.
Added `add_scopes` convenience function, which allows adding multiple scopes at once.
Added `clear_scopes` function to explicitly allow clearing method scopes.
Refactor modification of scopes
`add_scope` is simplified to simply add scopes, and no longer takes an `Option<_>` item.
Added `add_scopes` convenience function, which allows adding multiple scopes at once.
Added `clear_scopes` function to explicitly allow clearing method scopes.
The current implementation removes parameters if they are used - however, it only removes the first instance, and removes instances by index. However, when multiple items are being removed, following indices must be decremented by 1 to account for previously removed items.
This introduces the `serde_with` dependency and `rust_type.py`, to allow supporting arbitrary types for serialization.
Since fields may have arbitrary types (eg. `HashMap<_, chrono::Duration>`) which need deserialization, it is necessary to
use type-based serialization to avoid implementing (de)serialization for every permutation of types that require special serialization.
However, `serde` does not let you (de)serialize one type as another (eg. `chrono::Duration` as `Wrapper`) - thus necessitating `serde_with`, which does. `rust_type.py` introduces the `RustType` class, which makes it easy to describe the (de)serialization type used by `serde_with`
The serde traits are now directly implemented for FieldMask - this helps address potential serde issues with wrapper types, and simplifies the serde process somewhat.
If using #[serde(with = ...)] with an Option type, serde will expect all marked fields to be present. Adding #[serde(default)] restores expected behaviour - if no Option value is present, None will be used.