From bb72f0a4f7198dc8cb1b21b5a0bbebca32ccf0f7 Mon Sep 17 00:00:00 2001 From: Graham Esau Date: Thu, 29 Aug 2024 17:24:20 +0100 Subject: [PATCH] Update `inner` attribute docs --- docs/_includes/attributes.md | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/docs/_includes/attributes.md b/docs/_includes/attributes.md index 5da084d8..2ae66ab2 100644 --- a/docs/_includes/attributes.md +++ b/docs/_includes/attributes.md @@ -30,6 +30,7 @@ TABLE OF CONTENTS - [`regex` / `pattern`](#regex) - [`contains`](#contains) - [`required`](#required) + - [`inner`](#inner) 1. [Other Attributes](#other-attributes) - [`schema_with`](#schema_with) - [`title` / `description`](#title-description) @@ -260,6 +261,23 @@ Validator docs: [required](https://github.com/Keats/validator#required) +

+ +`#[garde(inner(...))]` / `#[schemars(inner(...))]` + +

+ +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, +} +``` + +Garde docs: [Inner type validation](https://github.com/jprochazk/garde?tab=readme-ov-file#inner-type-validation) + ## Other Attributes

@@ -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. -

- -`#[schemars(inner(...))]` - -

- -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, -} -``` -

`#[schemars(extend("key" = value))]`