From be92d4da5fc2cbc7e75f66abcc015e5a3d164047 Mon Sep 17 00:00:00 2001 From: Graham Esau Date: Fri, 27 Dec 2019 16:12:46 +0000 Subject: [PATCH] Clarify generic type behaviour in `with` attribute --- docs/1.1-attributes.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/1.1-attributes.md b/docs/1.1-attributes.md index 94a163f..9911ed7 100644 --- a/docs/1.1-attributes.md +++ b/docs/1.1-attributes.md @@ -117,6 +117,8 @@ Serde docs: [field](https://serde.rs/field-attrs.html#flatten) Set on a field to generate this field's schema as the given type instead of the field's actual type. Serde allows the `with` attribute to refer to any module path, but Schemars requires this to be an actual type which implements `JsonSchema`. +If the given type has any required generic type parameters, then they must all be explicitly specified in this attribute. Serde frequently allows you to omit them as it can make use of type inference, but unfortunately this is not possible with Schemars. For example, `with = "Vec::"` will work, but `with = "Vec"` and `with = "Vec::<_>"` will not. + Serde docs: [field](https://serde.rs/field-attrs.html#with)