--- a/Cargo.toml
+++ b/Cargo.toml
@@ -90,6 +90,7 @@ required-features = [
 [[test]]
 name = "bound"
 path = "tests/bound.rs"
+required-features = ["derive"]
 
 [[test]]
 name = "bytes"
@@ -99,11 +100,12 @@ required-features = ["bytes"]
 [[test]]
 name = "chrono"
 path = "tests/chrono.rs"
-required-features = ["chrono"]
+required-features = ["chrono","derive"]
 
 [[test]]
 name = "crate_alias"
 path = "tests/crate_alias.rs"
+required-features = ["derive"]
 
 [[test]]
 name = "decimal"
@@ -116,18 +118,22 @@ required-features = [
 [[test]]
 name = "default"
 path = "tests/default.rs"
+required-features = ["derive"]
 
 [[test]]
 name = "deprecated"
 path = "tests/deprecated.rs"
+required-features = ["derive"]
 
 [[test]]
 name = "dereference"
 path = "tests/dereference.rs"
+required-features = ["derive"]
 
 [[test]]
 name = "docs"
 path = "tests/docs.rs"
+required-features = ["derive"]
 
 [[test]]
 name = "either"
@@ -137,31 +143,37 @@ required-features = ["either"]
 [[test]]
 name = "enum"
 path = "tests/enum.rs"
+required-features = ["derive"]
 
 [[test]]
 name = "enum_deny_unknown_fields"
 path = "tests/enum_deny_unknown_fields.rs"
+required-features = ["derive"]
 
 [[test]]
 name = "enum_repr"
 path = "tests/enum_repr.rs"
+required-features = ["derive"]
 
 [[test]]
 name = "enumset"
 path = "tests/enumset.rs"
-required-features = ["enumset"]
+required-features = ["enumset", "derive"]
 
 [[test]]
 name = "examples"
 path = "tests/examples.rs"
+required-features = ["derive"]
 
 [[test]]
 name = "ffi"
 path = "tests/ffi.rs"
+required-features = ["derive"]
 
 [[test]]
 name = "flatten"
 path = "tests/flatten.rs"
+required-features = ["derive"]
 
 [[test]]
 name = "from_value"
@@ -170,48 +182,57 @@ path = "tests/from_value.rs"
 [[test]]
 name = "indexmap"
 path = "tests/indexmap.rs"
-required-features = ["indexmap"]
+required-features = ["indexmap", "derive"]
 
 [[test]]
 name = "indexmap2"
 path = "tests/indexmap2.rs"
-required-features = ["indexmap2"]
+required-features = ["indexmap2", "derive"]
 
 [[test]]
 name = "inline_subschemas"
 path = "tests/inline_subschemas.rs"
+required-features = ["derive"]
 
 [[test]]
 name = "macro"
 path = "tests/macro.rs"
+required-features = ["derive"]
 
 [[test]]
 name = "nonzero_ints"
 path = "tests/nonzero_ints.rs"
+required-features = ["derive"]
 
 [[test]]
 name = "property_name"
 path = "tests/property_name.rs"
+required-features = ["derive"]
 
 [[test]]
 name = "range"
 path = "tests/range.rs"
+required-features = ["derive"]
 
 [[test]]
 name = "remote_derive"
 path = "tests/remote_derive.rs"
+required-features = ["derive"]
 
 [[test]]
 name = "remote_derive_generic"
 path = "tests/remote_derive_generic.rs"
+required-features = ["derive"]
 
 [[test]]
 name = "result"
 path = "tests/result.rs"
+required-features = ["derive"]
 
 [[test]]
 name = "same_name"
 path = "tests/same_name.rs"
+required-features = ["derive"]
 
 [[test]]
 name = "schema_for_schema"
@@ -221,6 +242,7 @@ required-features = ["impl_json_schema"]
 [[test]]
 name = "schema_name"
 path = "tests/schema_name.rs"
+required-features = ["derive"]
 
 [[test]]
 name = "schema_settings"
@@ -229,19 +251,22 @@ path = "tests/schema_settings.rs"
 [[test]]
 name = "schema_with_enum"
 path = "tests/schema_with_enum.rs"
+required-features = ["derive"]
 
 [[test]]
 name = "schema_with_struct"
 path = "tests/schema_with_struct.rs"
+required-features = ["derive"]
 
 [[test]]
 name = "semver"
 path = "tests/semver.rs"
-required-features = ["semver"]
+required-features = ["semver", "derive"]
 
 [[test]]
 name = "skip"
 path = "tests/skip.rs"
+required-features = ["derive"]
 
 [[test]]
 name = "smallvec"
@@ -256,28 +281,32 @@ required-features = ["smol_str"]
 [[test]]
 name = "struct"
 path = "tests/struct.rs"
+required-features = ["derive"]
 
 [[test]]
 name = "struct_additional_properties"
 path = "tests/struct_additional_properties.rs"
+required-features = ["derive"]
 
 [[test]]
 name = "time"
 path = "tests/time.rs"
+required-features = ["derive"]
 
 [[test]]
 name = "transparent"
 path = "tests/transparent.rs"
+required-features = ["derive"]
 
 [[test]]
 name = "ui"
 path = "tests/ui.rs"
-required-features = ["ui_test"]
+required-features = ["ui_test", "derive"]
 
 [[test]]
 name = "url"
 path = "tests/url.rs"
-required-features = ["url"]
+required-features = ["url", "derive"]
 
 [[test]]
 name = "uuid"
@@ -289,10 +318,12 @@ required-features = [
 [[test]]
 name = "validate"
 path = "tests/validate.rs"
+required-features = ["derive"]
 
 [[test]]
 name = "validate_inner"
 path = "tests/validate_inner.rs"
+required-features = ["derive"]
 
 [dependencies.arrayvec07]
 version = "0.7"
--- a/README.md
+++ b/README.md
@@ -15,6 +15,8 @@ Generate JSON Schema documents from Rust
 If you don't really care about the specifics, the easiest way to generate a JSON schema for your types is to `#[derive(JsonSchema)]` and use the `schema_for!` macro. All fields of the type must also implement `JsonSchema` - Schemars implements this for many standard library types.
 
 ```rust
+#[cfg(feature = "derive")]
+{
 use schemars::{schema_for, JsonSchema};
 
 #[derive(JsonSchema)]
@@ -32,6 +34,7 @@ pub enum MyEnum {
 
 let schema = schema_for!(MyStruct);
 println!("{}", serde_json::to_string_pretty(&schema).unwrap());
+}
 ```
 
 <details>
@@ -108,6 +111,8 @@ println!("{}", serde_json::to_string_pre
 One of the main aims of this library is compatibility with [Serde](https://github.com/serde-rs/serde). Any generated schema _should_ match how [serde_json](https://github.com/serde-rs/json) would serialize/deserialize to/from JSON. To support this, Schemars will check for any `#[serde(...)]` attributes on types that derive `JsonSchema`, and adjust the generated schema accordingly.
 
 ```rust
+#[cfg(feature = "derive")]
+{
 use schemars::{schema_for, JsonSchema};
 use serde::{Deserialize, Serialize};
 
@@ -130,6 +135,7 @@ pub enum MyEnum {
 
 let schema = schema_for!(MyStruct);
 println!("{}", serde_json::to_string_pretty(&schema).unwrap());
+}
 ```
 
 <details>
--- a/examples/custom_serialization.rs
+++ b/examples/custom_serialization.rs
@@ -1,3 +1,4 @@
+#![cfg(feature = "derive")]
 use schemars::schema::{Schema, SchemaObject};
 use schemars::{r#gen::SchemaGenerator, schema_for, JsonSchema};
 use serde::{Deserialize, Serialize};
--- a/examples/custom_settings.rs
+++ b/examples/custom_settings.rs
@@ -1,3 +1,4 @@
+#![cfg(feature = "derive")]
 use schemars::{r#gen::SchemaSettings, JsonSchema};
 
 #[derive(JsonSchema)]
--- a/examples/doc_comments.rs
+++ b/examples/doc_comments.rs
@@ -1,3 +1,4 @@
+#![cfg(feature = "derive")]
 use schemars::{schema_for, JsonSchema};
 
 /// # My Amazing Struct
--- a/examples/enum_repr.rs
+++ b/examples/enum_repr.rs
@@ -1,3 +1,4 @@
+#![cfg(feature = "derive")]
 use schemars::{schema_for, JsonSchema_repr};
 
 #[derive(JsonSchema_repr)]
--- a/examples/main.rs
+++ b/examples/main.rs
@@ -1,3 +1,4 @@
+#![cfg(feature = "derive")]
 use schemars::{schema_for, JsonSchema};
 
 #[derive(JsonSchema)]
--- a/examples/remote_derive.rs
+++ b/examples/remote_derive.rs
@@ -1,3 +1,4 @@
+#![cfg(feature = "derive")]
 // Pretend that this is somebody else's crate, not a module.
 mod other_crate {
     // Neither Schemars nor the other crate provides a JsonSchema impl
--- a/examples/schemars_attrs.rs
+++ b/examples/schemars_attrs.rs
@@ -1,3 +1,4 @@
+#![cfg(feature = "derive")]
 use schemars::{schema_for, JsonSchema};
 use serde::{Deserialize, Serialize};
 
--- a/examples/serde_attrs.rs
+++ b/examples/serde_attrs.rs
@@ -1,3 +1,4 @@
+#![cfg(feature = "derive")]
 use schemars::{schema_for, JsonSchema};
 use serde::{Deserialize, Serialize};
 
--- a/examples/validate.rs
+++ b/examples/validate.rs
@@ -1,3 +1,4 @@
+#![cfg(feature = "derive")]
 use schemars::{schema_for, JsonSchema};
 
 #[derive(JsonSchema)]
--- a/src/gen.rs
+++ b/src/gen.rs
@@ -137,6 +137,8 @@ impl SchemaSettings {
 ///
 /// # Example
 /// ```
+/// #[cfg(feature = "derive")]
+/// {
 /// use schemars::{JsonSchema, r#gen::SchemaGenerator};
 ///
 /// #[derive(JsonSchema)]
@@ -146,6 +148,7 @@ impl SchemaSettings {
 ///
 /// let generator = SchemaGenerator::default();
 /// let schema = generator.into_root_schema_for::<MyStruct>();
+/// }
 /// ```
 #[derive(Debug, Default)]
 pub struct SchemaGenerator {
@@ -413,6 +416,8 @@ impl SchemaGenerator {
     ///
     /// # Example
     /// ```
+    /// #[cfg(feature = "derive")]
+    /// {
     /// use schemars::{JsonSchema, r#gen::SchemaGenerator};
     ///
     /// #[derive(JsonSchema)]
@@ -430,6 +435,7 @@ impl SchemaGenerator {
     /// assert!(dereferenced.is_some());
     /// assert!(!dereferenced.unwrap().is_ref());
     /// assert_eq!(dereferenced, generator.definitions().get("MyStruct"));
+    /// }
     /// ```
     pub fn dereference<'a>(&'a self, schema: &Schema) -> Option<&'a Schema> {
         match schema {
--- a/src/json_schema_impls/core.rs
+++ b/src/json_schema_impls/core.rs
@@ -196,6 +196,7 @@ mod tests {
     }
 
     #[test]
+    #[cfg(feature = "derive")]
     fn schema_for_option_with_ref() {
         use crate as schemars;
         #[derive(JsonSchema)]
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -64,6 +64,8 @@ use schema::Schema;
 /// # Examples
 /// Deriving an implementation:
 /// ```
+/// #[cfg(feature = "derive")]
+/// {
 /// use schemars::{schema_for, JsonSchema};
 ///
 /// #[derive(JsonSchema)]
@@ -72,6 +74,7 @@ use schema::Schema;
 /// }
 ///
 /// let my_schema = schema_for!(MyStruct);
+/// }
 /// ```
 ///
 /// When manually implementing `JsonSchema`, as well as determining an appropriate schema,
--- a/src/macros.rs
+++ b/src/macros.rs
@@ -4,6 +4,8 @@
 ///
 /// # Example
 /// ```
+/// #[cfg(feature = "derive")]
+/// {
 /// use schemars::{schema_for, JsonSchema};
 ///
 /// #[derive(JsonSchema)]
@@ -12,6 +14,7 @@
 /// }
 ///
 /// let my_schema = schema_for!(MyStruct);
+/// }
 /// ```
 #[cfg(doc)]
 #[macro_export]
--- a/tests/schema_settings.rs
+++ b/tests/schema_settings.rs
@@ -1,3 +1,4 @@
+#![cfg(feature = "derive")]
 mod util;
 use schemars::r#gen::SchemaSettings;
 use schemars::JsonSchema;
