diff --git a/docs/1-deriving.md b/docs/1-deriving.md
index 0bb4420..153ecc0 100644
--- a/docs/1-deriving.md
+++ b/docs/1-deriving.md
@@ -6,31 +6,4 @@ has_toc: false
permalink: /deriving/
---
-# Deriving JsonSchema
-
-The most important trait in Schemars is `JsonSchema`, and the most important function of that trait is `json_schema(...)` which returns a JSON schema describing the type. Implementing this manually on many types would be slow and error-prone, so Schemars includes a derive macro which can implement that trait for you. Any derived implementation of `JsonSchema` should create a schema that describes the JSON representation of the type if it were to be serialized by serde_json.
-
-Usually, all you need to do to use it is to add a `#[derive(JsonSchema)]` attribute to your type:
-
-```rust
-use schemars::{JsonSchema, schema_for};
-
-#[derive(JsonSchema, Debug)]
-struct Point {
- x: i32,
- y: i32,
-}
-
-fn main() {
- let schema = schema_for!(Point);
-
- let serialized = serde_json::to_string(&schema).unwrap();
- println!("{}", serialized);
-}
-```
-
-
+{% include deriving.md %}
diff --git a/docs/1.1-attributes.md b/docs/1.1-attributes.md
index 498eff9..edb1dbd 100644
--- a/docs/1.1-attributes.md
+++ b/docs/1.1-attributes.md
@@ -11,351 +11,4 @@ h3 code {
}
-# Attributes
-
-You can add attributes to your types to customize Schemars's derived `JsonSchema` implementation.
-
-[Serde](https://serde.rs/) allows setting `#[serde(...)]` attributes which change how types are serialized, and Schemars will generally respect these attributes to ensure that generated schemas will match how the type is serialized by serde_json. `#[serde(...)]` attributes can be overriden using `#[schemars(...)]` attributes, which behave identically (e.g. `#[schemars(rename_all = "camelCase")]`). You may find this useful if you want to change the generated schema without affecting Serde's behaviour, or if you're just not using Serde.
-
-[Validator](https://github.com/Keats/validator) allows setting `#[validate(...)]` attributes to restrict valid values of particular fields, many of which will be used by Schemars to generate more accurate schemas. These can also be overridden by `#[schemars(...)]` attributes.
-
-
-
-TABLE OF CONTENTS
-
-
-1. [Supported Serde Attributes](#supported-serde-attributes)
- - [`rename`](#rename)
- - [`rename_all`](#rename_all)
- - [`tag` / `content` / `untagged`](#tag)
- - [`default`](#default)
- - [`skip`](#skip)
- - [`skip_serializing`](#skip_serializing)
- - [`skip_deserializing`](#skip_deserializing)
- - [`flatten`](#flatten)
- - [`with`](#with)
- - [`bound`](#bound)
-1. [Supported Validator Attributes](#supported-validator-attributes)
- - [`email` / `phone` / `url`](#email-phone-url)
- - [`length`](#length)
- - [`range`](#range)
- - [`regex`](#regex)
- - [`contains`](#contains)
- - [`required` / `required_nested`](#required)
-1. [Other Attributes](#other-attributes)
- - [`schema_with`](#schema_with)
- - [`title` / `description`](#title-description)
- - [`example`](#example)
- - [`deprecated`](#deprecated)
- - [`crate`](#crate)
- - [`extend`](#extend)
- - [`transform`](#transform)
- - [Doc Comments (`doc`)](#doc)
-
-
-
-## Supported Serde Attributes
-
-
-
-
-
-`#[serde(rename = "name")]` / `#[schemars(rename = "name")]`
-
-
-
-Set on a struct, enum, field or variant to use the given name in the generated schema instead of the Rust name. When used on a struct or enum, the given name will be used as the title for root schemas, and the key within the root's `$defs` property for subschemas.
-
-If set on a struct or enum with generic type parameters, then the given name may contain them enclosed in curly braces (e.g. `{T}`) and they will be replaced with the concrete type names when the schema is generated.
-
-Serde docs: [container](https://serde.rs/container-attrs.html#rename) / [variant](https://serde.rs/variant-attrs.html#rename) / [field](https://serde.rs/field-attrs.html#rename)
-
-
-
-`#[serde(rename_all = "...")]` / `#[schemars(rename_all = "...")]`
-
-
-
-Set on a struct, enum or variant to rename all fields according to the given case convention (see the Serde docs for details).
-
-Serde docs: [container](https://serde.rs/container-attrs.html#rename_all) / [variant](https://serde.rs/variant-attrs.html#rename_all)
-
-
-
-`#[serde(tag = "type")]` / `#[schemars(tag = "type")]`
-`#[serde(tag = "t", content = "c")]` / `#[schemars(tag = "t", content = "c")]`
-`#[serde(untagged)]` / `#[schemars(untagged)]`
-
-
-
-Set on an enum to generate the schema for the [internally tagged](https://serde.rs/enum-representations.html#internally-tagged), [adjacently tagged](https://serde.rs/enum-representations.html#adjacently-tagged), or [untagged](https://serde.rs/enum-representations.html#untagged) representation of this enum.
-
-Serde docs: [`tag`](https://serde.rs/container-attrs.html#tag) / [`tag`+`content`](https://serde.rs/container-attrs.html#tag--content) / [`untagged`](https://serde.rs/container-attrs.html#untagged)
-
-
-
-`#[serde(default)]` / `#[schemars(default)]` / `#[serde(default = "path")]` / `#[schemars(default = "path")]`
-
-
-
-Set on a struct or field to give fields a default value, which excludes them from the schema's `required` properties. The default will also be set on the field's schema's `default` property, unless it is skipped by a [`skip_serializing_if`](https://serde.rs/field-attrs.html#skip_serializing_if) attribute on the field. Any [`serialize_with`](https://serde.rs/field-attrs.html#serialize_with) or [`with`](https://serde.rs/field-attrs.html#with) attribute set on the field will be used to serialize the default value.
-
-Serde docs: [container](https://serde.rs/container-attrs.html#default) / [field](https://serde.rs/field-attrs.html#default)
-
-
-
-`#[serde(skip)]` / `#[schemars(skip)]`
-
-
-
-Set on a variant or field to prevent it from appearing in any generated schema.
-
-Serde docs: [variant](https://serde.rs/variant-attrs.html#skip) / [field](https://serde.rs/field-attrs.html#skip)
-
-
-
-`#[serde(skip_serializing)]` / `#[schemars(skip_serializing)]`
-
-
-
-Set on a field of a (non-tuple) struct to set the `writeOnly` property on that field's schema. Serde also allows this attribute on variants or tuple struct fields, but this will have no effect on generated schemas.
-
-Serde docs: [field](https://serde.rs/field-attrs.html#skip_deserializing)
-
-
-
-`#[serde(skip_deserializing)]` / `#[schemars(skip_deserializing)]`
-
-
-
-Set on a variant or field. When set on a field of a (non-tuple) struct, that field's schema will have the `readOnly` property set. When set on a variant or tuple struct field Schemars will treat this the same as a [`skip`](#skip) attribute.
-
-Serde docs: [variant](https://serde.rs/variant-attrs.html#skip_deserializing) / [field](https://serde.rs/field-attrs.html#skip_deserializing)
-
-
-
-`#[serde(flatten)]` / `#[schemars(flatten)]`
-
-
-
-Set on a field to include that field's contents as though they belonged to the field's container.
-
-Serde docs: [field](https://serde.rs/field-attrs.html#flatten)
-
-
-
-`#[serde(with = "Type")]` / `#[schemars(with = "Type")]`
-
-
-
-Set on a variant or field to generate its schema as the given type instead of its actual type. Serde allows the `with` attribute to refer to any module path, but Schemars requires this to be an actual type which implements `JsonSchema`.
-
-If the given type has any required generic type parameters, then they must all be explicitly specified in this attribute. Serde frequently allows you to omit them as it can make use of type inference, but unfortunately this is not possible with Schemars. For example, `with = "Vec::"` will work, but `with = "Vec"` and `with = "Vec::<_>"` will not.
-
-Serde docs: [variant](https://serde.rs/variant-attrs.html#with) / [field](https://serde.rs/field-attrs.html#with)
-
-
-
-`#[serde(deny_unknown_fields)]` / `#[schemars(deny_unknown_fields)]`
-
-
-
-Setting this on a container will set the `additionalProperties` keyword on generated schemas to `false` to show that any extra properties are explicitly disallowed.
-
-Serde docs: [container](https://serde.rs/container-attrs.html#deny_unknown_fields)
-
-
-
-`#[serde(transparent)]` / `#[schemars(transparent)]`
-
-
-
-Set on a newtype struct or a braced struct with one field to make the struct's generated schema exactly the same as that of the single field's.
-
-Serde docs: [container](https://serde.rs/container-attrs.html#transparent)
-
-
-
-`#[schemars(bound = "...")]`
-
-
-
-Where-clause for the JsonSchema impl. This replaces any trait bounds inferred by schemars. Schemars does **not** use trait bounds from `#[serde(bound)]` attributes.
-
-Serde docs: [container](https://serde.rs/container-attrs.html#bound)
-
-
-
-## Supported Validator Attributes
-
-
-
-
-
-`#[validate(email)]` / `#[schemars(email)]`
-`#[validate(phone)]` / `#[schemars(phone)]`
-`#[validate(url)]` / `#[schemars(url)]`
-
-
-
-Sets the schema's `format` to `email`/`phone`/`uri`, as appropriate. Only one of these attributes may be present on a single field.
-
-Validator docs: [email](https://github.com/Keats/validator#email) / [phone](https://github.com/Keats/validator#phone) / [url](https://github.com/Keats/validator#url)
-
-
-
-`#[validate(length(min = 1, max = 10))]` / `#[schemars(length(min = 1, max = 10))]`
-`#[validate(length(equal = 10))]` / `#[schemars(length(equal = 10))]`
-
-
-
-Sets the `minLength`/`maxLength` properties for string schemas, or the `minItems`/`maxItems` properties for array schemas.
-
-Validator docs: [length](https://github.com/Keats/validator#length)
-
-
-
-`#[validate(range(min = 1, max = 10))]` / `#[schemars(range(min = 1, max = 10))]`
-
-
-
-Sets the `minimum`/`maximum` properties for number schemas.
-
-Validator docs: [range](https://github.com/Keats/validator#range)
-
-
-
-`#[validate(regex = "path::to::regex")]` / `#[schemars(regex = "path::to::regex")]`
-`#[schemars(regex(pattern = r"^\d+$"))]`
-
-
-
-Sets the `pattern` property for string schemas. The `path::to::regex` will typically refer to a [`Regex`](https://docs.rs/regex/*/regex/struct.Regex.html) instance, but Schemars allows it to be any value with a `to_string()` method.
-
-Providing an inline regex pattern using `regex(pattern = ...)` is a Schemars extension, and not currently supported by the Validator crate. When using this form, you may want to use a `r"raw string literal"` so that `\\` characters in the regex pattern are not interpreted as escape sequences in the string.
-
-Validator docs: [regex](https://github.com/Keats/validator#regex)
-
-
-
-`#[validate(contains = "string")]` / `#[schemars(contains = "string")]`
-
-
-
-For string schemas, sets the `pattern` property to the given value, with any regex special characters escaped. For object schemas (e.g. when the attribute is set on a HashMap field), includes the value in the `required` property, indicating that the map must contain it as a key.
-
-Validator docs: [contains](https://github.com/Keats/validator#contains)
-
-
-
-`#[validate(required)]` / `#[schemars(required)]`
-`#[validate(required_nested)]`
-
-
-
-When set on an `Option` field, this will create a schemas as though the field were a `T`.
-
-Validator docs: [required](https://github.com/Keats/validator#required) / [required_nested](https://github.com/Keats/validator#required_nested)
-
-
-
-## Other Attributes
-
-
-
-`#[schemars(schema_with = "some::function")]`
-
-
-
-Set on a variant or field to generate this field's schema using the given function. This function must be callable as `fn(&mut schemars::SchemaGenerator) -> schemars::schema::Schema`.
-
-
-
-`#[schemars(title = "Some title", description = "Some description")]`
-
-
-
-Set on a container, variant or field to set the generated schema's `title` and/or `description`. If present, these will be used instead of values from any [`doc` comments/attributes](#doc).
-
-
-
-`#[schemars(example = "some::function")]`
-
-
-
-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.
-
-
-
-`#[deprecated]`
-
-
-
-Set the Rust built-in [`deprecated`](https://doc.rust-lang.org/edition-guide/rust-2018/the-compiler/an-attribute-for-deprecation.html) attribute on a struct, enum, field or variant to set the generated schema's `deprecated` keyword to `true`.
-
-
-
-`#[schemars(crate = "other_crate::schemars")]`
-
-
-
-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-validator-attributes) on items of an array schema. For example:
-
-```rs
-struct Struct {
- #[schemars(inner(url, regex(pattern = "^https://")))]
- urls: Vec,
-}
-```
-
-
-
-`#[schemars(extend("key" = value))]`
-
-
-
-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
-#[derive(JsonSchema)]
-#[schemars(extend("simple" = "string value", "complex" = {"array": [1, 2, 3]}))]
-struct Struct;
-```
-
-
-
-Set on a container, variant or field to run a `schemars::transform::Transform` against the generated schema. This can be specified multiple times to run multiple transforms.
-
-The `Transform` trait is implemented on functions with the signature `fn(&mut Schema) -> ()`, allowing you to do this:
-
-```rust
-fn my_transform(schema: &mut Schema) {
- todo!()
-}
-
-#[derive(JsonSchema)]
-#[schemars(transform = my_transform)]
-struct Struct;
-```
-
-
-
-Doc Comments (`#[doc = "..."]`)
-
-
-
-If a struct, variant or field has any [doc comments](https://doc.rust-lang.org/stable/rust-by-example/meta/doc.html#doc-comments) (or [`doc` attributes](https://doc.rust-lang.org/rustdoc/the-doc-attribute.html)), then these will be used as the generated schema's `description`. If the first line is an ATX-style markdown heading (i.e. it begins with a # character), then it will be used as the schema's `title`, and the remaining lines will be the `description`.
+{% include attributes.md %}
diff --git a/docs/_includes/attributes.md b/docs/_includes/attributes.md
new file mode 100644
index 0000000..155d942
--- /dev/null
+++ b/docs/_includes/attributes.md
@@ -0,0 +1,348 @@
+# Attributes
+
+You can add attributes to your types to customize Schemars's derived `JsonSchema` implementation.
+
+[Serde](https://serde.rs/) allows setting `#[serde(...)]` attributes which change how types are serialized, and Schemars will generally respect these attributes to ensure that generated schemas will match how the type is serialized by serde_json. `#[serde(...)]` attributes can be overriden using `#[schemars(...)]` attributes, which behave identically (e.g. `#[schemars(rename_all = "camelCase")]`). You may find this useful if you want to change the generated schema without affecting Serde's behaviour, or if you're just not using Serde.
+
+[Validator](https://github.com/Keats/validator) allows setting `#[validate(...)]` attributes to restrict valid values of particular fields, many of which will be used by Schemars to generate more accurate schemas. These can also be overridden by `#[schemars(...)]` attributes.
+
+
+
+TABLE OF CONTENTS
+
+
+1. [Supported Serde Attributes](#supported-serde-attributes)
+ - [`rename`](#rename)
+ - [`rename_all`](#rename_all)
+ - [`tag` / `content` / `untagged`](#tag)
+ - [`default`](#default)
+ - [`skip`](#skip)
+ - [`skip_serializing`](#skip_serializing)
+ - [`skip_deserializing`](#skip_deserializing)
+ - [`flatten`](#flatten)
+ - [`with`](#with)
+ - [`bound`](#bound)
+1. [Supported Validator Attributes](#supported-validator-attributes)
+ - [`email` / `phone` / `url`](#email-phone-url)
+ - [`length`](#length)
+ - [`range`](#range)
+ - [`regex`](#regex)
+ - [`contains`](#contains)
+ - [`required` / `required_nested`](#required)
+1. [Other Attributes](#other-attributes)
+ - [`schema_with`](#schema_with)
+ - [`title` / `description`](#title-description)
+ - [`example`](#example)
+ - [`deprecated`](#deprecated)
+ - [`crate`](#crate)
+ - [`extend`](#extend)
+ - [`transform`](#transform)
+ - [Doc Comments (`doc`)](#doc)
+
+
+
+## Supported Serde Attributes
+
+
+
+
+
+`#[serde(rename = "name")]` / `#[schemars(rename = "name")]`
+
+
+
+Set on a struct, enum, field or variant to use the given name in the generated schema instead of the Rust name. When used on a struct or enum, the given name will be used as the title for root schemas, and the key within the root's `$defs` property for subschemas.
+
+If set on a struct or enum with generic type parameters, then the given name may contain them enclosed in curly braces (e.g. `{T}`) and they will be replaced with the concrete type names when the schema is generated.
+
+Serde docs: [container](https://serde.rs/container-attrs.html#rename) / [variant](https://serde.rs/variant-attrs.html#rename) / [field](https://serde.rs/field-attrs.html#rename)
+
+
+
+`#[serde(rename_all = "...")]` / `#[schemars(rename_all = "...")]`
+
+
+
+Set on a struct, enum or variant to rename all fields according to the given case convention (see the Serde docs for details).
+
+Serde docs: [container](https://serde.rs/container-attrs.html#rename_all) / [variant](https://serde.rs/variant-attrs.html#rename_all)
+
+
+
+`#[serde(tag = "type")]` / `#[schemars(tag = "type")]`
+`#[serde(tag = "t", content = "c")]` / `#[schemars(tag = "t", content = "c")]`
+`#[serde(untagged)]` / `#[schemars(untagged)]`
+
+
+
+Set on an enum to generate the schema for the [internally tagged](https://serde.rs/enum-representations.html#internally-tagged), [adjacently tagged](https://serde.rs/enum-representations.html#adjacently-tagged), or [untagged](https://serde.rs/enum-representations.html#untagged) representation of this enum.
+
+Serde docs: [`tag`](https://serde.rs/container-attrs.html#tag) / [`tag`+`content`](https://serde.rs/container-attrs.html#tag--content) / [`untagged`](https://serde.rs/container-attrs.html#untagged)
+
+
+
+`#[serde(default)]` / `#[schemars(default)]` / `#[serde(default = "path")]` / `#[schemars(default = "path")]`
+
+
+
+Set on a struct or field to give fields a default value, which excludes them from the schema's `required` properties. The default will also be set on the field's schema's `default` property, unless it is skipped by a [`skip_serializing_if`](https://serde.rs/field-attrs.html#skip_serializing_if) attribute on the field. Any [`serialize_with`](https://serde.rs/field-attrs.html#serialize_with) or [`with`](https://serde.rs/field-attrs.html#with) attribute set on the field will be used to serialize the default value.
+
+Serde docs: [container](https://serde.rs/container-attrs.html#default) / [field](https://serde.rs/field-attrs.html#default)
+
+
+
+`#[serde(skip)]` / `#[schemars(skip)]`
+
+
+
+Set on a variant or field to prevent it from appearing in any generated schema.
+
+Serde docs: [variant](https://serde.rs/variant-attrs.html#skip) / [field](https://serde.rs/field-attrs.html#skip)
+
+
+
+`#[serde(skip_serializing)]` / `#[schemars(skip_serializing)]`
+
+
+
+Set on a field of a (non-tuple) struct to set the `writeOnly` property on that field's schema. Serde also allows this attribute on variants or tuple struct fields, but this will have no effect on generated schemas.
+
+Serde docs: [field](https://serde.rs/field-attrs.html#skip_deserializing)
+
+
+
+`#[serde(skip_deserializing)]` / `#[schemars(skip_deserializing)]`
+
+
+
+Set on a variant or field. When set on a field of a (non-tuple) struct, that field's schema will have the `readOnly` property set. When set on a variant or tuple struct field Schemars will treat this the same as a [`skip`](#skip) attribute.
+
+Serde docs: [variant](https://serde.rs/variant-attrs.html#skip_deserializing) / [field](https://serde.rs/field-attrs.html#skip_deserializing)
+
+
+
+`#[serde(flatten)]` / `#[schemars(flatten)]`
+
+
+
+Set on a field to include that field's contents as though they belonged to the field's container.
+
+Serde docs: [field](https://serde.rs/field-attrs.html#flatten)
+
+
+
+`#[serde(with = "Type")]` / `#[schemars(with = "Type")]`
+
+
+
+Set on a variant or field to generate its schema as the given type instead of its actual type. Serde allows the `with` attribute to refer to any module path, but Schemars requires this to be an actual type which implements `JsonSchema`.
+
+If the given type has any required generic type parameters, then they must all be explicitly specified in this attribute. Serde frequently allows you to omit them as it can make use of type inference, but unfortunately this is not possible with Schemars. For example, `with = "Vec::"` will work, but `with = "Vec"` and `with = "Vec::<_>"` will not.
+
+Serde docs: [variant](https://serde.rs/variant-attrs.html#with) / [field](https://serde.rs/field-attrs.html#with)
+
+
+
+`#[serde(deny_unknown_fields)]` / `#[schemars(deny_unknown_fields)]`
+
+
+
+Setting this on a container will set the `additionalProperties` keyword on generated schemas to `false` to show that any extra properties are explicitly disallowed.
+
+Serde docs: [container](https://serde.rs/container-attrs.html#deny_unknown_fields)
+
+
+
+`#[serde(transparent)]` / `#[schemars(transparent)]`
+
+
+
+Set on a newtype struct or a braced struct with one field to make the struct's generated schema exactly the same as that of the single field's.
+
+Serde docs: [container](https://serde.rs/container-attrs.html#transparent)
+
+
+
+`#[schemars(bound = "...")]`
+
+
+
+Where-clause for the JsonSchema impl. This replaces any trait bounds inferred by schemars. Schemars does **not** use trait bounds from `#[serde(bound)]` attributes.
+
+Serde docs: [container](https://serde.rs/container-attrs.html#bound)
+
+
+
+## Supported Validator Attributes
+
+
+
+
+
+`#[validate(email)]` / `#[schemars(email)]`
+`#[validate(phone)]` / `#[schemars(phone)]`
+`#[validate(url)]` / `#[schemars(url)]`
+
+
+
+Sets the schema's `format` to `email`/`phone`/`uri`, as appropriate. Only one of these attributes may be present on a single field.
+
+Validator docs: [email](https://github.com/Keats/validator#email) / [phone](https://github.com/Keats/validator#phone) / [url](https://github.com/Keats/validator#url)
+
+
+
+`#[validate(length(min = 1, max = 10))]` / `#[schemars(length(min = 1, max = 10))]`
+`#[validate(length(equal = 10))]` / `#[schemars(length(equal = 10))]`
+
+
+
+Sets the `minLength`/`maxLength` properties for string schemas, or the `minItems`/`maxItems` properties for array schemas.
+
+Validator docs: [length](https://github.com/Keats/validator#length)
+
+
+
+`#[validate(range(min = 1, max = 10))]` / `#[schemars(range(min = 1, max = 10))]`
+
+
+
+Sets the `minimum`/`maximum` properties for number schemas.
+
+Validator docs: [range](https://github.com/Keats/validator#range)
+
+
+
+`#[validate(regex = "path::to::regex")]` / `#[schemars(regex = "path::to::regex")]`
+`#[schemars(regex(pattern = r"^\d+$"))]`
+
+
+
+Sets the `pattern` property for string schemas. The `path::to::regex` will typically refer to a [`Regex`](https://docs.rs/regex/*/regex/struct.Regex.html) instance, but Schemars allows it to be any value with a `to_string()` method.
+
+Providing an inline regex pattern using `regex(pattern = ...)` is a Schemars extension, and not currently supported by the Validator crate. When using this form, you may want to use a `r"raw string literal"` so that `\\` characters in the regex pattern are not interpreted as escape sequences in the string.
+
+Validator docs: [regex](https://github.com/Keats/validator#regex)
+
+
+
+`#[validate(contains = "string")]` / `#[schemars(contains = "string")]`
+
+
+
+For string schemas, sets the `pattern` property to the given value, with any regex special characters escaped. For object schemas (e.g. when the attribute is set on a HashMap field), includes the value in the `required` property, indicating that the map must contain it as a key.
+
+Validator docs: [contains](https://github.com/Keats/validator#contains)
+
+
+
+`#[validate(required)]` / `#[schemars(required)]`
+`#[validate(required_nested)]`
+
+
+
+When set on an `Option` field, this will create a schemas as though the field were a `T`.
+
+Validator docs: [required](https://github.com/Keats/validator#required) / [required_nested](https://github.com/Keats/validator#required_nested)
+
+
+
+## Other Attributes
+
+
+
+`#[schemars(schema_with = "some::function")]`
+
+
+
+Set on a variant or field to generate this field's schema using the given function. This function must be callable as `fn(&mut schemars::SchemaGenerator) -> schemars::schema::Schema`.
+
+
+
+`#[schemars(title = "Some title", description = "Some description")]`
+
+
+
+Set on a container, variant or field to set the generated schema's `title` and/or `description`. If present, these will be used instead of values from any [`doc` comments/attributes](#doc).
+
+
+
+`#[schemars(example = "some::function")]`
+
+
+
+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.
+
+
+
+`#[deprecated]`
+
+
+
+Set the Rust built-in [`deprecated`](https://doc.rust-lang.org/edition-guide/rust-2018/the-compiler/an-attribute-for-deprecation.html) attribute on a struct, enum, field or variant to set the generated schema's `deprecated` keyword to `true`.
+
+
+
+`#[schemars(crate = "other_crate::schemars")]`
+
+
+
+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-validator-attributes) on items of an array schema. For example:
+
+```rs
+struct Struct {
+ #[schemars(inner(url, regex(pattern = "^https://")))]
+ urls: Vec,
+}
+```
+
+
+
+`#[schemars(extend("key" = value))]`
+
+
+
+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
+#[derive(JsonSchema)]
+#[schemars(extend("simple" = "string value", "complex" = {"array": [1, 2, 3]}))]
+struct Struct;
+```
+
+
+
+Set on a container, variant or field to run a `schemars::transform::Transform` against the generated schema. This can be specified multiple times to run multiple transforms.
+
+The `Transform` trait is implemented on functions with the signature `fn(&mut Schema) -> ()`, allowing you to do this:
+
+```rust
+fn my_transform(schema: &mut Schema) {
+ todo!()
+}
+
+#[derive(JsonSchema)]
+#[schemars(transform = my_transform)]
+struct Struct;
+```
+
+
+
+Doc Comments (`#[doc = "..."]`)
+
+
+
+If a struct, variant or field has any [doc comments](https://doc.rust-lang.org/stable/rust-by-example/meta/doc.html#doc-comments) (or [`doc` attributes](https://doc.rust-lang.org/rustdoc/the-doc-attribute.html)), then these will be used as the generated schema's `description`. If the first line is an ATX-style markdown heading (i.e. it begins with a # character), then it will be used as the schema's `title`, and the remaining lines will be the `description`.
diff --git a/docs/_includes/deriving.md b/docs/_includes/deriving.md
new file mode 100644
index 0000000..0d2c484
--- /dev/null
+++ b/docs/_includes/deriving.md
@@ -0,0 +1,28 @@
+# Deriving JsonSchema
+
+The most important trait in Schemars is `JsonSchema`, and the most important function of that trait is `json_schema(...)` which returns a JSON schema describing the type. Implementing this manually on many types would be slow and error-prone, so Schemars includes a derive macro which can implement that trait for you. Any derived implementation of `JsonSchema` should create a schema that describes the JSON representation of the type if it were to be serialized by serde_json.
+
+Usually, all you need to do to use it is to add a `#[derive(JsonSchema)]` attribute to your type:
+
+```rust
+use schemars::{JsonSchema, schema_for};
+
+#[derive(JsonSchema, Debug)]
+struct Point {
+ x: i32,
+ y: i32,
+}
+
+fn main() {
+ let schema = schema_for!(Point);
+
+ let serialized = serde_json::to_string(&schema).unwrap();
+ println!("{}", serialized);
+}
+```
+
+
diff --git a/schemars/src/lib.rs b/schemars/src/lib.rs
index 5dffb03..ae3ebac 100644
--- a/schemars/src/lib.rs
+++ b/schemars/src/lib.rs
@@ -40,6 +40,7 @@ pub extern crate alloc as _alloc;
#[doc(hidden)]
pub extern crate serde_json as _serde_json;
+#[doc(inline)]
pub use generate::SchemaGenerator;
pub use schema::Schema;
@@ -69,7 +70,7 @@ pub mod r#gen {
///
/// This can also be automatically derived on most custom types with `#[derive(JsonSchema)]` by
/// enabling the `derive` feature flag (which is enabled by default).
-/// For more info on deriving `JsonSchema`, see .
+/// For more info on deriving `JsonSchema`, see [the derive macro documentation](derive@JsonSchema).
///
/// # Examples
/// Deriving an implementation:
diff --git a/schemars_derive/attributes.md b/schemars_derive/attributes.md
new file mode 120000
index 0000000..882c89c
--- /dev/null
+++ b/schemars_derive/attributes.md
@@ -0,0 +1 @@
+../docs/_includes/attributes.md
\ No newline at end of file
diff --git a/schemars_derive/deriving.md b/schemars_derive/deriving.md
new file mode 120000
index 0000000..075caee
--- /dev/null
+++ b/schemars_derive/deriving.md
@@ -0,0 +1 @@
+../docs/_includes/deriving.md
\ No newline at end of file
diff --git a/schemars_derive/src/lib.rs b/schemars_derive/src/lib.rs
index 32a5d9f..9a44eb8 100644
--- a/schemars_derive/src/lib.rs
+++ b/schemars_derive/src/lib.rs
@@ -16,6 +16,9 @@ use ast::*;
use proc_macro2::TokenStream;
use syn::spanned::Spanned;
+#[doc = "Derive macro for `JsonSchema` trait."]
+#[doc = include_str!("../deriving.md")]
+#[doc = include_str!("../attributes.md")]
#[proc_macro_derive(JsonSchema, attributes(schemars, serde, validate))]
pub fn derive_json_schema_wrapper(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
let input = parse_macro_input!(input as syn::DeriveInput);