Here is my struct
#[derive(Serialize, Deserialize, Clone, Copy, Debug, JsonSchema)]
pub struct Position {
x: SignedDecimal,
y: SignedDecimal,
}
#[derive(Serialize, Deserialize, Clone, Copy, Debug, JsonSchema)]
pub struct SignedDecimal {
value: Decimal256,
sign: bool,
}
An example output of the default schema looks like this:
{
"x": { "value": "1.5", "sign": true },
"y": { "value": "1.5", "sign": true }
}
What I want it to look like is this:
{
"x": "1.5",
"y": "1.5"
}
But I can't seem to get the Schemars macros to do what I want. I've tried many things, like this for example:
#[derive(Serialize, Deserialize, Clone, Copy, Debug, JsonSchema)]
#[schemars(schema_with = "String")]
pub struct SignedDecimal {
value: Decimal256,
sign: bool,
}
Ideally I am not using any additional macros on the Position struct, and instead just modifying the SignedDecimal struct. All of the relevant String impls have been defined, I just can't make the macro do what I want.