Skip to content

Commit

Permalink
Add note to docs about setting examples via the extend attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
GREsau committed Aug 25, 2024
1 parent 7c0ba8d commit fb6bd6d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/_includes/attributes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"]))]`.

<h3 id="deprecated">

`#[deprecated]`
Expand Down

0 comments on commit fb6bd6d

Please sign in to comment.