schemars icon indicating copy to clipboard operation
schemars copied to clipboard

Map schemas do not specify the key type

Open link2xt opened this issue 2 years ago • 0 comments

In the current implementation at https://github.com/GREsau/schemars/blob/386e3d7f5ac601795fb4e247291bbef31512ded3/schemars/src/json_schema_impls/maps.rs only the V type is used, but K type is ignored.

For example, HashMap<u32, String> gets a schema {'type': 'object', 'additionalProperties': {'type': 'string'}}, and u32 type is not reflected in it.

Downstream issue discussion is at https://github.com/deltachat/deltachat-core-rust/pull/4602#issuecomment-1664907971

link2xt avatar Aug 04 '23 14:08 link2xt