Update inner attribute docs

This commit is contained in:
Graham Esau 2024-08-29 17:24:20 +01:00
parent 9770301218
commit bb72f0a4f7

View file

@ -30,6 +30,7 @@ TABLE OF CONTENTS
- [`regex` / `pattern`](#regex) - [`regex` / `pattern`](#regex)
- [`contains`](#contains) - [`contains`](#contains)
- [`required`](#required) - [`required`](#required)
- [`inner`](#inner)
1. [Other Attributes](#other-attributes) 1. [Other Attributes](#other-attributes)
- [`schema_with`](#schema_with) - [`schema_with`](#schema_with)
- [`title` / `description`](#title-description) - [`title` / `description`](#title-description)
@ -260,6 +261,23 @@ Validator docs: [required](https://github.com/Keats/validator#required)
</div> </div>
<h3 id="inner">
`#[garde(inner(...))]` / `#[schemars(inner(...))]`
</h3>
Sets properties specified by [validation attributes](#supported-validatorgarde-attributes) on items of an array schema. For example:
```rust
struct Struct {
#[schemars(inner(url, pattern("^https://")))]
urls: Vec<String>,
}
```
Garde docs: [Inner type validation](https://github.com/jprochazk/garde?tab=readme-ov-file#inner-type-validation)
## Other Attributes ## Other Attributes
<h3 id="schema_with"> <h3 id="schema_with">
@ -304,21 +322,6 @@ Set the Rust built-in [`deprecated`](https://doc.rust-lang.org/edition-guide/rus
Set the path to the schemars crate instance the generated code should depend on. This is mostly useful for other crates that depend on schemars in their macros. Set the path to the schemars crate instance the generated code should depend on. This is mostly useful for other crates that depend on schemars in their macros.
<h3 id="inner">
`#[schemars(inner(...))]`
</h3>
Sets properties specified by [validator attributes](#supported-validatorgarde-attributes) on items of an array schema. For example:
```rust
struct Struct {
#[schemars(inner(url, regex(pattern = "^https://")))]
urls: Vec<String>,
}
```
<h3 id="extend"> <h3 id="extend">
`#[schemars(extend("key" = value))]` `#[schemars(extend("key" = value))]`