xmlgen generates incorrect proxies for uppercase-named properties
When generating proxy for properties which names contains few consecutive uppercase characters, they get converted to lowercase. But when these properties are accessed they don't expand back to uppercase, resulting in panic.
In particular, I'm working with Bluez D-Bus API. And org.bluez.Adapter1
interface has a property UUIDs
. The generated proxy has it as:
/// UUIDs property
#[dbus_proxy(property)]
fn uuids(&self) -> zbus::Result<Vec<String>>;
and when accessed, it expands to Uuids
and panics:
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: FDO(InvalidArgs("No such property \'Uuids\'"))', src/bt/mod.rs:87:49
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
This is not a big issue, as it is very easy to fix in generated code by adding name="UUIDs"
to the macro:
/// UUIDs property
#[dbus_proxy(property, name="UUIDs")]
fn uuids(&self) -> zbus::Result<Vec<String>>;
But I guess ideally xmlgen should do it automatically.
Edited by Andrii Zymohliad