You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using typify for a configuration file, and the configuration it produces is used all over the place. I don't want to deal with conversion errors everywhere, I want to deal with them when the configuration is loaded.
Some of the fields are expected to be of type usize. So I tried the convert keyword:
typify::import_types!(
schema = "./config/encoder_schema.json",
convert = {
{
type = "integer",
format = "usize",
} = usize,
}
);
I was confused by the documentation. I was able to have usize fields by using "$ref": "#/definitions/usize" in the schema and Usize = usize inside replace. $defs or definitions are interchangeable, both work as long as there is just one section with definitions.
The documentation needs improvement, but that would be separate issue. Closing this issue.
I'm using typify for a configuration file, and the configuration it produces is used all over the place. I don't want to deal with conversion errors everywhere, I want to deal with them when the configuration is loaded.
Some of the fields are expected to be of type
usize
. So I tried theconvert
keyword:The schema has:
And yet the generated type is u64, as seen in the output of
cargo expand
.I'm using typify 0.3.0.
The text was updated successfully, but these errors were encountered: