mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-03 00:43:46 +00:00
Add support for multiple inheritance (#1664)
* add all parent names * clean up supportsInheritance * fix npe * fix allVars, fix test cases * add more tests, remove comments * update docker m2 cache dir, add more tests, fix mandatory * update samples * regenerate js spec files * add logic to detect self reference * add isSelfReference flag to codegen property * add ruby tests for cat model * remove debugging info * fix JS allvars not have x-js-doctype * update samples * update js samples
This commit is contained in:
@@ -457,26 +457,26 @@ mkCapitalization =
|
||||
-- ** Cat
|
||||
-- | Cat
|
||||
data Cat = Cat
|
||||
{ catDeclawed :: !(Maybe Bool) -- ^ "declawed"
|
||||
, catClassName :: !(Text) -- ^ /Required/ "className"
|
||||
{ catClassName :: !(Text) -- ^ /Required/ "className"
|
||||
, catColor :: !(Maybe Text) -- ^ "color"
|
||||
, catDeclawed :: !(Maybe Bool) -- ^ "declawed"
|
||||
} deriving (P.Show, P.Eq, P.Typeable)
|
||||
|
||||
-- | FromJSON Cat
|
||||
instance A.FromJSON Cat where
|
||||
parseJSON = A.withObject "Cat" $ \o ->
|
||||
Cat
|
||||
<$> (o .:? "declawed")
|
||||
<*> (o .: "className")
|
||||
<$> (o .: "className")
|
||||
<*> (o .:? "color")
|
||||
<*> (o .:? "declawed")
|
||||
|
||||
-- | ToJSON Cat
|
||||
instance A.ToJSON Cat where
|
||||
toJSON Cat {..} =
|
||||
_omitNulls
|
||||
[ "declawed" .= catDeclawed
|
||||
, "className" .= catClassName
|
||||
[ "className" .= catClassName
|
||||
, "color" .= catColor
|
||||
, "declawed" .= catDeclawed
|
||||
]
|
||||
|
||||
|
||||
@@ -486,9 +486,9 @@ mkCat
|
||||
-> Cat
|
||||
mkCat catClassName =
|
||||
Cat
|
||||
{ catDeclawed = Nothing
|
||||
, catClassName
|
||||
{ catClassName
|
||||
, catColor = Nothing
|
||||
, catDeclawed = Nothing
|
||||
}
|
||||
|
||||
-- ** Category
|
||||
@@ -584,26 +584,26 @@ mkClient =
|
||||
-- ** Dog
|
||||
-- | Dog
|
||||
data Dog = Dog
|
||||
{ dogBreed :: !(Maybe Text) -- ^ "breed"
|
||||
, dogClassName :: !(Text) -- ^ /Required/ "className"
|
||||
{ dogClassName :: !(Text) -- ^ /Required/ "className"
|
||||
, dogColor :: !(Maybe Text) -- ^ "color"
|
||||
, dogBreed :: !(Maybe Text) -- ^ "breed"
|
||||
} deriving (P.Show, P.Eq, P.Typeable)
|
||||
|
||||
-- | FromJSON Dog
|
||||
instance A.FromJSON Dog where
|
||||
parseJSON = A.withObject "Dog" $ \o ->
|
||||
Dog
|
||||
<$> (o .:? "breed")
|
||||
<*> (o .: "className")
|
||||
<$> (o .: "className")
|
||||
<*> (o .:? "color")
|
||||
<*> (o .:? "breed")
|
||||
|
||||
-- | ToJSON Dog
|
||||
instance A.ToJSON Dog where
|
||||
toJSON Dog {..} =
|
||||
_omitNulls
|
||||
[ "breed" .= dogBreed
|
||||
, "className" .= dogClassName
|
||||
[ "className" .= dogClassName
|
||||
, "color" .= dogColor
|
||||
, "breed" .= dogBreed
|
||||
]
|
||||
|
||||
|
||||
@@ -613,9 +613,9 @@ mkDog
|
||||
-> Dog
|
||||
mkDog dogClassName =
|
||||
Dog
|
||||
{ dogBreed = Nothing
|
||||
, dogClassName
|
||||
{ dogClassName
|
||||
, dogColor = Nothing
|
||||
, dogBreed = Nothing
|
||||
}
|
||||
|
||||
-- ** EnumArrays
|
||||
|
||||
@@ -156,11 +156,6 @@ capitalizationAttNameL f Capitalization{..} = (\capitalizationAttName -> Capital
|
||||
|
||||
-- * Cat
|
||||
|
||||
-- | 'catDeclawed' Lens
|
||||
catDeclawedL :: Lens_' Cat (Maybe Bool)
|
||||
catDeclawedL f Cat{..} = (\catDeclawed -> Cat { catDeclawed, ..} ) <$> f catDeclawed
|
||||
{-# INLINE catDeclawedL #-}
|
||||
|
||||
-- | 'catClassName' Lens
|
||||
catClassNameL :: Lens_' Cat (Text)
|
||||
catClassNameL f Cat{..} = (\catClassName -> Cat { catClassName, ..} ) <$> f catClassName
|
||||
@@ -171,6 +166,11 @@ catColorL :: Lens_' Cat (Maybe Text)
|
||||
catColorL f Cat{..} = (\catColor -> Cat { catColor, ..} ) <$> f catColor
|
||||
{-# INLINE catColorL #-}
|
||||
|
||||
-- | 'catDeclawed' Lens
|
||||
catDeclawedL :: Lens_' Cat (Maybe Bool)
|
||||
catDeclawedL f Cat{..} = (\catDeclawed -> Cat { catDeclawed, ..} ) <$> f catDeclawed
|
||||
{-# INLINE catDeclawedL #-}
|
||||
|
||||
|
||||
|
||||
-- * Category
|
||||
@@ -207,11 +207,6 @@ clientClientL f Client{..} = (\clientClient -> Client { clientClient, ..} ) <$>
|
||||
|
||||
-- * Dog
|
||||
|
||||
-- | 'dogBreed' Lens
|
||||
dogBreedL :: Lens_' Dog (Maybe Text)
|
||||
dogBreedL f Dog{..} = (\dogBreed -> Dog { dogBreed, ..} ) <$> f dogBreed
|
||||
{-# INLINE dogBreedL #-}
|
||||
|
||||
-- | 'dogClassName' Lens
|
||||
dogClassNameL :: Lens_' Dog (Text)
|
||||
dogClassNameL f Dog{..} = (\dogClassName -> Dog { dogClassName, ..} ) <$> f dogClassName
|
||||
@@ -222,6 +217,11 @@ dogColorL :: Lens_' Dog (Maybe Text)
|
||||
dogColorL f Dog{..} = (\dogColor -> Dog { dogColor, ..} ) <$> f dogColor
|
||||
{-# INLINE dogColorL #-}
|
||||
|
||||
-- | 'dogBreed' Lens
|
||||
dogBreedL :: Lens_' Dog (Maybe Text)
|
||||
dogBreedL f Dog{..} = (\dogBreed -> Dog { dogBreed, ..} ) <$> f dogBreed
|
||||
{-# INLINE dogBreedL #-}
|
||||
|
||||
|
||||
|
||||
-- * EnumArrays
|
||||
|
||||
@@ -138,9 +138,9 @@ instance Arbitrary Capitalization where
|
||||
instance Arbitrary Cat where
|
||||
arbitrary =
|
||||
Cat
|
||||
<$> arbitrary -- catDeclawed :: Maybe Bool
|
||||
<*> arbitrary -- catClassName :: Text
|
||||
<$> arbitrary -- catClassName :: Text
|
||||
<*> arbitrary -- catColor :: Maybe Text
|
||||
<*> arbitrary -- catDeclawed :: Maybe Bool
|
||||
|
||||
instance Arbitrary Category where
|
||||
arbitrary =
|
||||
@@ -161,9 +161,9 @@ instance Arbitrary Client where
|
||||
instance Arbitrary Dog where
|
||||
arbitrary =
|
||||
Dog
|
||||
<$> arbitrary -- dogBreed :: Maybe Text
|
||||
<*> arbitrary -- dogClassName :: Text
|
||||
<$> arbitrary -- dogClassName :: Text
|
||||
<*> arbitrary -- dogColor :: Maybe Text
|
||||
<*> arbitrary -- dogBreed :: Maybe Text
|
||||
|
||||
instance Arbitrary EnumArrays where
|
||||
arbitrary =
|
||||
|
||||
Reference in New Issue
Block a user