In Protobuf, unless explicitly required (which is discouraged), every field are optional.
This cause trouble in Rust because some field are expected to be set, and those fields type might not have meaningful defaults.
As a result, the current implementation either unwrap or expect said fields, which could cause a server-side panic() to be triggered.
I propose to add a TryFromApi trait, so we can safely abort the RPC in case of conversion error, and log the issue so the users can fix their config.
We'll then need to rewrite any fallible FromApi to make use of this trait instead.
In Protobuf, unless explicitly
required(which is discouraged), every field are optional.This cause trouble in Rust because some field are expected to be set, and those fields type might not have meaningful defaults.
As a result, the current implementation either unwrap or expect said fields, which could cause a server-side
panic()to be triggered.I propose to add a
TryFromApitrait, so we can safely abort the RPC in case of conversion error, and log the issue so the users can fix their config.We'll then need to rewrite any fallible
FromApito make use of this trait instead.