diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,14 @@
 # Changelog
 
+## [0.5.0.0] - 2025-06-20
+
+This is technically a breaking change but it's unlikely that you'll need to
+change any of your codecs.
+
+### Changed
+
+* Added the same `Coercible` trick to the `RequiredKeyCodec` constructor of a codec.
+
 ## [0.4.2.2] - 2024-09-01
 
 ### Added
diff --git a/autodocodec.cabal b/autodocodec.cabal
--- a/autodocodec.cabal
+++ b/autodocodec.cabal
@@ -1,11 +1,11 @@
 cabal-version: 1.12
 
--- This file has been generated from package.yaml by hpack version 0.36.0.
+-- This file has been generated from package.yaml by hpack version 0.36.1.
 --
 -- see: https://github.com/sol/hpack
 
 name:           autodocodec
-version:        0.4.2.2
+version:        0.5.0.0
 synopsis:       Self-documenting encoder and decoder
 homepage:       https://github.com/NorfairKing/autodocodec#readme
 bug-reports:    https://github.com/NorfairKing/autodocodec/issues
diff --git a/src/Autodocodec/Aeson/Compat.hs b/src/Autodocodec/Aeson/Compat.hs
--- a/src/Autodocodec/Aeson/Compat.hs
+++ b/src/Autodocodec/Aeson/Compat.hs
@@ -5,12 +5,17 @@
 #if MIN_VERSION_aeson(2,0,0)
 import Data.Aeson.Key (Key)
 import qualified Data.Aeson.Key as K
+import Data.Aeson.KeyMap (KeyMap)
 import qualified Data.Aeson.KeyMap as KM
 #else
 import qualified Data.HashMap.Strict as HM
+import qualified Data.HashSet as HS
+import qualified Data.Map as M
 #endif
 import qualified Data.Aeson as JSON
 import qualified Data.Aeson.Types as JSON
+import Data.Set (Set)
+import qualified Data.Set as S
 import Data.Text (Text)
 
 #if MIN_VERSION_aeson(2,0,0)
@@ -30,60 +35,83 @@
 #endif
 
 #if MIN_VERSION_aeson(2,0,0)
-lookupKey :: Key -> KM.KeyMap v -> Maybe v
+lookupKey :: Key -> KeyMap v -> Maybe v
 lookupKey = KM.lookup
 #else
-lookupKey :: Text -> HM.HashMap Text v -> Maybe v
+lookupKey :: Text -> HashMap Text v -> Maybe v
 lookupKey = HM.lookup
 #endif
 
 #if MIN_VERSION_aeson(2,0,0)
-insert :: Key -> v -> KM.KeyMap v -> KM.KeyMap v
+insert :: Key -> v -> KeyMap v -> KeyMap v
 insert = KM.insert
 #else
-insert :: Text -> v -> HM.HashMap Text v -> HM.HashMap Text v
+insert :: Text -> v -> HashMap Text v -> HashMap Text v
 insert = HM.insert
 #endif
 
 #if MIN_VERSION_aeson(2,0,0)
-fromList :: [(Key, v)] -> KM.KeyMap v
+fromList :: [(Key, v)] -> KeyMap v
 fromList = KM.fromList
 #else
-fromList :: [(Text, v)] -> HM.HashMap Text v
+fromList :: [(Text, v)] -> HashMap Text v
 fromList = HM.fromList
 #endif
 
 #if MIN_VERSION_aeson(2,0,0)
-toList ::  KM.KeyMap v -> [(Key, v)]
+toList :: KeyMap v -> [(Key, v)]
 toList = KM.toList
 #else
-toList ::HM.HashMap Text v -> [(Text, v)]
+toList :: HashMap Text v -> [(Text, v)]
 toList = HM.toList
 #endif
 
 #if MIN_VERSION_aeson(2,0,0)
-map ::  (v1 -> v2) -> KM.KeyMap v1 -> KM.KeyMap v2
+keysSet :: KeyMap v -> Set Key
+keysSet = S.fromList .  KM.keys
+#else
+keysSet :: HashHashMap Text v -> Set Key
+keysSet = S.fromList . HS.toList . HM.keysSet
+#endif
+
+#if MIN_VERSION_aeson(2,0,0)
+map :: (v1 -> v2) -> KeyMap v1 -> KeyMap v2
 map = KM.map
 #else
-map ::  (v1 -> v2) -> HM.HashMap Text v1 -> HM.HashMap Text v2
+map :: (v1 -> v2) -> HashMap Text v1 -> HashMap Text v2
 map = HM.map
 #endif
 
-liftToJSON :: (JSON.ToJSON1 f) => (a -> JSON.Value) -> ([a] -> JSON.Value) -> f a -> JSON.Value
+liftToJSON ::
+  (JSON.ToJSON1 f) =>
+  (a -> JSON.Value) ->
+  ([a] -> JSON.Value) ->
+  f a ->
+  JSON.Value
 #if MIN_VERSION_aeson(2,2,0)
 liftToJSON = JSON.liftToJSON (const False)
 #else
 liftToJSON = JSON.liftToJSON
 #endif
 
-liftToEncoding :: (JSON.ToJSON1 f) => (a -> JSON.Encoding) -> ([a] -> JSON.Encoding) -> f a -> JSON.Encoding
+liftToEncoding ::
+  (JSON.ToJSON1 f) =>
+  (a -> JSON.Encoding) ->
+  ([a] -> JSON.Encoding) ->
+  f a ->
+  JSON.Encoding
 #if MIN_VERSION_aeson(2,2,0)
 liftToEncoding = JSON.liftToEncoding (const False)
 #else
 liftToEncoding = JSON.liftToEncoding
 #endif
 
-liftParseJSON :: (JSON.FromJSON1 f) => (JSON.Value -> JSON.Parser a) -> (JSON.Value -> JSON.Parser [a]) -> JSON.Value -> JSON.Parser (f a)
+liftParseJSON ::
+  (JSON.FromJSON1 f) =>
+  (JSON.Value -> JSON.Parser a) ->
+  (JSON.Value -> JSON.Parser [a]) ->
+  JSON.Value ->
+  JSON.Parser (f a)
 #if MIN_VERSION_aeson(2,2,0)
 liftParseJSON = JSON.liftParseJSON Nothing
 #else
diff --git a/src/Autodocodec/Aeson/Decode.hs b/src/Autodocodec/Aeson/Decode.hs
--- a/src/Autodocodec/Aeson/Decode.hs
+++ b/src/Autodocodec/Aeson/Decode.hs
@@ -144,8 +144,8 @@
                   Left err -> prependFailure ("  Previous branch failure: " <> err <> "\n") (rightParser value)
               DisjointUnion ->
                 case (parseEither leftParser value, parseEither rightParser value) of
-                  (Left _, Right r) -> pure r
                   (Right l, Left _) -> pure l
+                  (Left _, Right r) -> pure r
                   (Right _, Right _) -> fail "Both branches of a disjoint union succeeded."
                   (Left lErr, Left rErr) ->
                     fail $
@@ -164,7 +164,7 @@
       ReferenceCodec _ c -> go value c
       RequiredKeyCodec k c _ -> do
         valueAtKey <- (value :: JSON.Object) JSON..: Compat.toKey k
-        go valueAtKey c JSON.<?> Key (Compat.toKey k)
+        coerce $ go valueAtKey c JSON.<?> Key (Compat.toKey k)
       OptionalKeyCodec k c _ -> do
         let key = Compat.toKey k
             mValueAtKey = Compat.lookupKey key (value :: JSON.Object)
diff --git a/src/Autodocodec/Aeson/Encode.hs b/src/Autodocodec/Aeson/Encode.hs
--- a/src/Autodocodec/Aeson/Encode.hs
+++ b/src/Autodocodec/Aeson/Encode.hs
@@ -44,7 +44,7 @@
   where
     go :: a -> ObjectCodec a void -> JSON.Object
     go a = \case
-      RequiredKeyCodec k c _ -> Compat.toKey k JSON..= toJSONVia c a
+      RequiredKeyCodec k c _ -> Compat.toKey k JSON..= toJSONVia c (coerce a)
       OptionalKeyCodec k c _ -> case (coerce a :: Maybe _) of
         Nothing -> mempty
         Just b -> Compat.toKey k JSON..= toJSONVia c b
@@ -102,7 +102,7 @@
   where
     goObject :: a -> ObjectCodec a void -> JSON.Series
     goObject a = \case
-      RequiredKeyCodec k c _ -> JSON.pair (Compat.toKey k) (toEncodingVia c a)
+      RequiredKeyCodec k c _ -> JSON.pair (Compat.toKey k) (toEncodingVia c (coerce a))
       OptionalKeyCodec k c _ -> case (coerce a :: Maybe _) of
         Nothing -> mempty :: JSON.Series
         Just b -> JSON.pair (Compat.toKey k) (toEncodingVia c b)
diff --git a/src/Autodocodec/Codec.hs b/src/Autodocodec/Codec.hs
--- a/src/Autodocodec/Codec.hs
+++ b/src/Autodocodec/Codec.hs
@@ -240,13 +240,14 @@
     ~(ValueCodec input output) ->
     ValueCodec input output
   RequiredKeyCodec ::
+    (Coercible a input, Coercible b output) =>
     -- | Key
     Text ->
     -- | Codec for the value
     ValueCodec input output ->
     -- | Documentation
     Maybe Text ->
-    ObjectCodec input output
+    ObjectCodec a b
   OptionalKeyCodec ::
     (Coercible a (Maybe input), Coercible b (Maybe output)) =>
     -- | Key
