diff --git a/docs/_includes/attributes.md b/docs/_includes/attributes.md index 155d942..db8c094 100644 --- a/docs/_includes/attributes.md +++ b/docs/_includes/attributes.md @@ -296,7 +296,7 @@ Set the path to the schemars crate instance the generated code should depend on. Sets properties specified by [validator attributes](#supported-validator-attributes) on items of an array schema. For example: -```rs +```rust struct Struct { #[schemars(inner(url, regex(pattern = "^https://")))] urls: Vec, diff --git a/schemars_derive/src/lib.rs b/schemars_derive/src/lib.rs index 9a44eb8..6954519 100644 --- a/schemars_derive/src/lib.rs +++ b/schemars_derive/src/lib.rs @@ -17,8 +17,7 @@ use proc_macro2::TokenStream; use syn::spanned::Spanned; #[doc = "Derive macro for `JsonSchema` trait."] -#[doc = include_str!("../deriving.md")] -#[doc = include_str!("../attributes.md")] +#[cfg_attr(not(doctest), 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);