diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,8 @@
 # Revision history for schemas
 
+## 0.3.0.1 --  2019-10-25
+* Fix a bug that made OpenApi2 generation diverge.
+
 ## 0.3.0 --  2019-10-23
 * Fixed a bug in isSubtypeOf for unions
 * Fixed exponential performance (#3)
diff --git a/example/Person2.hs b/example/Person2.hs
--- a/example/Person2.hs
+++ b/example/Person2.hs
@@ -9,6 +9,7 @@
 import           Data.Generics.Labels  ()
 import           Data.List.NonEmpty (NonEmpty)
 import qualified Data.List.NonEmpty as NE
+import           Data.Maybe
 import           Data.String
 import           GHC.Exts (IsList(..))
 import           Person
@@ -18,7 +19,7 @@
 --   and renames 'studies' to 'education'
 data Person2 = Person2
   { name      :: String
-  , age       :: Int
+  , age       :: Maybe Int
   , addresses :: [String]
   , religion  :: (Maybe Religion)  -- new
   , education :: NonEmpty Education         -- renamed
@@ -39,14 +40,14 @@
     record
       $   Person2
       <$> field "name"      Person2.name
-      <*> field "age"       Person2.age
+      <*> (optField "age"       Person2.age <|> fieldWith (dimap (fromMaybe (-1)) Just schema) "age" Person2.age)
       <*> field "addresses" Person2.addresses
       <*> optField "religion"  Person2.religion
       <*> (field "education" Person2.education <|> (NE.:| []) <$> field "studies" (NE.head . Person2.education))
 
 pepe2 :: Person2
 pepe2 = Person2 "Pepe"
-                38
+                (Just 38)
                 ["2 Edward Square", "La Mar 10"]
                 Nothing
                 [PhD "Computer Science", Degree "Engineering" ]
diff --git a/schemas.cabal b/schemas.cabal
--- a/schemas.cabal
+++ b/schemas.cabal
@@ -1,6 +1,6 @@
 cabal-version:       2.0
 name:                schemas
-version:             0.3.0
+version:             0.3.0.1
 synopsis:            schema guided serialization
 description:
   Schemas is a Haskell library for serializing and deserializing data in JSON.
diff --git a/src/Schemas/OpenApi2.hs b/src/Schemas/OpenApi2.hs
--- a/src/Schemas/OpenApi2.hs
+++ b/src/Schemas/OpenApi2.hs
@@ -81,7 +81,7 @@
   deriving anyclass (SOP.Generic, SOP.HasDatatypeInfo)
 
 instance HasSchema OpenApi2Schema where
-  schema = gSchema defOptions { fieldLabelModifier = dropWhile (== '_') }
+  schema = named "OpenApi2" $ gSchema defOptions { fieldLabelModifier = dropWhile (== '_') }
 
 defOpenApi2Schema :: OpenApi2Type -> OpenApi2Schema
 defOpenApi2Schema t =
diff --git a/test/SchemasSpec.hs b/test/SchemasSpec.hs
--- a/test/SchemasSpec.hs
+++ b/test/SchemasSpec.hs
@@ -92,14 +92,15 @@
   describe "examples" $ do
     let   person4_v0 = theSchema @Person4
           person2_v0 = theSchema @Person2
+          person2_v2 = extractSchema (schema @Person2) NE.!! 2
           person3_v0 = theSchema @Person3
-          person4_vPerson2 = person2_v0
           person4_vPerson3 = person3_v0
           encoder_p4v0 = encodeTo person4_v0
           encoder_p3_to_p4 = encodeTo person4_vPerson3
-          encoder_p2_to_p4 = encodeTo person4_vPerson2
           encoder_p2v0 = encodeTo person2_v0
           encoder_p3v0 = encodeTo @Person3 person3_v0
+          decoder_p2v0 = decodeFrom @Person4 person2_v0
+          decoder_p2v2 = decodeFrom person2_v2
     describe "Person" $ do
       schemaSpec schema pepe
     describe "Person2" $ do
@@ -125,15 +126,14 @@
       schemaSpec schema pepe4
       let encoded_pepe4 = fromRight undefined encoder_p4v0 pepe4
           encoded_pepe3 = fromRight undefined encoder_p3_to_p4 pepe3{Person3.spouse = Nothing}
-          encoded_pepe2 = fromRight undefined encoder_p2_to_p4 pepe2
-          encoded_pepe2' = fromRight undefined encoder_p2v0 pepe2
+          encoded_pepe2 = fromRight undefined encoder_p2v0 pepe2
       it "can compute an encoder for Person4" $ do
         shouldNotLoop $ evaluate encoder_p4v0
         encoder_p4v0 `shouldSatisfy` isRight
-      it "can compute an encoder for Person3 in finite time" $ do
+      it "can compute an encoder to Person3 in finite time" $ do
         shouldNotLoop $ evaluate encoder_p3_to_p4
-      it "can compute an encoder for Person2 in finite time" $ do
-        shouldNotLoop $ evaluate encoder_p2_to_p4
+      it "can compute an encoder to Person2 in finite time" $ do
+        shouldNotLoop $ evaluate encoder_p2v0
       it "can encode a Person4" $ do
         shouldNotLoop $ evaluate $ A.encode encoded_pepe4
       it "can encode a Person2 as Person4 in finite time" $ do
@@ -146,12 +146,12 @@
         let res = decode encoded_pepe4
         shouldNotLoop $ evaluate res
         res `shouldBe` Right pepe4
-      it "can decode a Person2 encoded to Person4 with source schema" $ do
-        let res = fromRight undefined (decodeFrom person4_vPerson2) encoded_pepe2
-        shouldNotLoop $ evaluate res
-        res `shouldBe` Right pepe4
-      it "can decode a Person2" $ do
-        let res = fromRight undefined (decodeFrom person2_v0) encoded_pepe2'
+      it "cannot construct a Person2 v0 decoder" $
+        decoder_p2v0 `shouldSatisfy` isLeft
+      it "can construct a Person2 v1 decoder" $
+        decoder_p2v2 `shouldSatisfy` isRight
+      it "can decode a Person2 v1" $ do
+        let res = fromRight undefined decoder_p2v2 encoded_pepe2
             holds = res == Right pepe4
         shouldNotLoop $ evaluate holds
         shouldNotLoop $ evaluate $ length $ show res
