From fb6bd6d43986bd5990b7cfffe9c2089be03cdffc Mon Sep 17 00:00:00 2001 From: Graham Esau Date: Sun, 25 Aug 2024 13:09:18 +0100 Subject: [PATCH] Add note to docs about setting `examples` via the `extend` attribute --- docs/_includes/attributes.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/_includes/attributes.md b/docs/_includes/attributes.md index db8c0945..7449d28a 100644 --- a/docs/_includes/attributes.md +++ b/docs/_includes/attributes.md @@ -272,6 +272,8 @@ Set on a container, variant or field to set the generated schema's `title` and/o Set on a container, variant or field to include the result of the given function in the generated schema's `examples`. The function should take no parameters and can return any type that implements serde's `Serialize` trait - it does not need to return the same type as the attached struct/field. This attribute can be repeated to specify multiple examples. +To use the result of arbitrary expressions as examples, you can instead use the [`extend`](#extend) attribute, e.g. `[schemars(extend("examples" = ["example string"]))]`. +

`#[deprecated]`