diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,9 @@
 # Changelog
 
+## [0.2.1.4] - 2024-07-29
+
+* Non-orphan version of the `ToSchema` deriving.
+
 ## [0.2.1.3] - 2024-07-26
 
 * Support for `autodocodec >=0.4`.
diff --git a/autodocodec-openapi3.cabal b/autodocodec-openapi3.cabal
--- a/autodocodec-openapi3.cabal
+++ b/autodocodec-openapi3.cabal
@@ -5,7 +5,7 @@
 -- see: https://github.com/sol/hpack
 
 name:           autodocodec-openapi3
-version:        0.2.1.3
+version:        0.2.1.4
 synopsis:       Autodocodec interpreters for openapi3
 homepage:       https://github.com/NorfairKing/autodocodec#readme
 bug-reports:    https://github.com/NorfairKing/autodocodec/issues
@@ -27,6 +27,7 @@
   exposed-modules:
       Autodocodec.OpenAPI
       Autodocodec.OpenAPI.DerivingVia
+      Autodocodec.OpenAPI.DerivingVia.NonOrphan
       Autodocodec.OpenAPI.Schema
   other-modules:
       Paths_autodocodec_openapi3
diff --git a/src/Autodocodec/OpenAPI/DerivingVia.hs b/src/Autodocodec/OpenAPI/DerivingVia.hs
--- a/src/Autodocodec/OpenAPI/DerivingVia.hs
+++ b/src/Autodocodec/OpenAPI/DerivingVia.hs
@@ -3,14 +3,24 @@
 
 module Autodocodec.OpenAPI.DerivingVia where
 
-import Autodocodec
-import Autodocodec.OpenAPI.Schema
-import Data.OpenApi as OpenAPI
-import Data.Proxy
-import Data.Typeable
+import Autodocodec (Autodocodec, HasCodec)
+import Autodocodec.OpenAPI.Schema (declareNamedSchemaViaCodec)
+import qualified Data.OpenApi as OpenAPI
+import Data.Proxy (Proxy (Proxy))
+import Data.Typeable (Typeable)
 
 -- | An instance for 'Autodocodec' that lets you use 'DerivingVia' to derive 'OpenAPI.ToSchema' if your type has a 'HasCodec' instance.
 --
 -- > deriving (OpenAPI.ToSchema) via (Autodocodec FooBar)
 instance (Typeable a, HasCodec a) => OpenAPI.ToSchema (Autodocodec a) where
-  declareNamedSchema (Proxy :: Proxy (Autodocodec a)) = declareNamedSchemaViaCodec (Proxy :: Proxy a)
+  -- This is declared like this as because now 'declareNamedSchema' takes no arguments, it can be memoized (like a top level variable is).
+  -- As a result, the result of the 'let', that is the schema, should also be memoized,
+  -- so with this definition schema in 'declaredNamedSchema' should only need to be calculated once IF the instance is of the form:
+  -- > deriving (OpenAPI.ToSchema) via (Autodocodec FooBar)
+  -- where FooBar is a concrete type.
+  -- If the instance is of the form:
+  -- > deriving via (Autodocodec (FooBar a)) instance (OpenAPI.ToSchema (FooBar a))
+  -- this memoisation trick probably won't work (as 'declaredNamedSchema' actually is a function due to hiddent typeclass dictionary arguments)
+  -- but it shouldn't hurt to try. See:
+  -- https://stackoverflow.com/questions/77056264/caching-an-expensive-to-compute-result-in-a-class-instance
+  declareNamedSchema = let schema = declareNamedSchemaViaCodec (Proxy :: Proxy a) in const schema
diff --git a/src/Autodocodec/OpenAPI/DerivingVia/NonOrphan.hs b/src/Autodocodec/OpenAPI/DerivingVia/NonOrphan.hs
new file mode 100644
--- /dev/null
+++ b/src/Autodocodec/OpenAPI/DerivingVia/NonOrphan.hs
@@ -0,0 +1,18 @@
+{-# LANGUAGE ScopedTypeVariables #-}
+
+module Autodocodec.OpenAPI.DerivingVia.NonOrphan where
+
+import Autodocodec.Class (HasCodec)
+import Autodocodec.OpenAPI.Schema (declareNamedSchemaViaCodec)
+import qualified Data.OpenApi as OpenAPI
+import Data.Proxy (Proxy (Proxy))
+import Data.Typeable (Typeable)
+
+newtype AutodocodecOpenApi a = AutodocodecOpenApi {unAutodocodecSwagger :: a}
+
+-- | An instance for 'Autodocodec' that lets you use 'DerivingVia' to derive 'OpenAPI.ToSchema' if your type has a 'HasCodec' instance.
+--
+-- > deriving (OpenAPI.ToSchema) via (Autodocodec FooBar)
+instance (Typeable a, HasCodec a) => OpenAPI.ToSchema (AutodocodecOpenApi a) where
+  -- See comments in 'Autodocodec.OpenAPI.DerivingVia' for the reason why this is defined like this.
+  declareNamedSchema = let schema = declareNamedSchemaViaCodec (Proxy :: Proxy a) in const schema
