So this will serialize as { "some_field_name": "string contents" }
Is there away to force this external type into using camelCase without redefining the whole struct? So that it serializes as: { "someFieldName": "string contents" }
The only way to do this is duplicating the structure with your own serialization requirements satisfied. See Derive for remote crate · Serde, which covers a similar situation where the remote type does not implement the serde traits at all. The only difference in your case is that the remote type does implement the traits, but the implementations are not usable.
Rust does not allow external types to do anything they are not designed to do. What you can do is customize its behavior with your own trait (e.g. the extension trait pattern) or provide your own type (may or may not be a newtype) to implement an external trait on the external type. The latter is exactly what the "Derive for remote crate" example does. But it's kind of unique because it handles the conversion/wrapping for you.
Thanks, @parasyte!
That's not as easy as I'd hoped, but definitely not as bad as I feared either. I think it should work. I was unaware of the "remote" attribute.