Add extend
attribute to docs
This commit is contained in:
parent
d511d447f7
commit
692958353d
1 changed files with 16 additions and 0 deletions
|
@ -48,6 +48,7 @@ TABLE OF CONTENTS
|
||||||
- [`example`](#example)
|
- [`example`](#example)
|
||||||
- [`deprecated`](#deprecated)
|
- [`deprecated`](#deprecated)
|
||||||
- [`crate`](#crate)
|
- [`crate`](#crate)
|
||||||
|
- [`extend`](#extend)
|
||||||
- [Doc Comments (`doc`)](#doc)
|
- [Doc Comments (`doc`)](#doc)
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
@ -314,6 +315,21 @@ struct Struct {
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
<h3 id="extend">
|
||||||
|
|
||||||
|
`#[schemars(extend("key" = value))]`
|
||||||
|
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
Set on a container, variant or field to add properties (or replace existing properties) in a generated schema. This can contain multiple key/value pairs and/or be specified multiple times, as long as each key is unique.
|
||||||
|
|
||||||
|
The key must be a quoted string, and the value can be any expression that produces a type implementing `serde::Serialize`. The value can also be a JSON literal which can interpolate other values.
|
||||||
|
|
||||||
|
```plaintext
|
||||||
|
#[schemars(extend("simple" = "string value", "complex" = {"array": [1, 2, 3]}))]
|
||||||
|
struct Struct;
|
||||||
|
```
|
||||||
|
|
||||||
<h3 id="doc">
|
<h3 id="doc">
|
||||||
|
|
||||||
Doc Comments (`#[doc = "..."]`)
|
Doc Comments (`#[doc = "..."]`)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue