mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-10 12:06:19 +00:00
Better OpenAPI spec v3 support: allOf, anyOf, oneOf (#1360)
* add oneOf support to Ruby
* add anyOf support to ruby client
* add discriminator support to ruby client
* fix typo
* update samples, fix NPE
* better format in ruby generator
* fix test cases, disable mapping test
* fix update script, update samples
* add test, fix mapping
* update exit code
* reenabled discriminator test
* remove duplicated properties
* add test for duplicated properties
* update samples, add new spec
* fix ruby test cases
* fix hasMore after removing duplicates
* refactor method, comment out haskell client test
* fix hasMore and update samples
* fix parent detection
* fix discriminator check
* [haskell-http-client] need to use {{vars}}{{required}} instead of {{requiredVars}}
* remove deprecated methods in default codegen (#1031)
* regenerate samples
* remove commented code
This commit is contained in:
@@ -457,26 +457,26 @@ mkCapitalization =
|
||||
-- ** Cat
|
||||
-- | Cat
|
||||
data Cat = Cat
|
||||
{ catClassName :: !(Text) -- ^ /Required/ "className"
|
||||
{ catDeclawed :: !(Maybe Bool) -- ^ "declawed"
|
||||
, 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 .: "className")
|
||||
<$> (o .:? "declawed")
|
||||
<*> (o .: "className")
|
||||
<*> (o .:? "color")
|
||||
<*> (o .:? "declawed")
|
||||
|
||||
-- | ToJSON Cat
|
||||
instance A.ToJSON Cat where
|
||||
toJSON Cat {..} =
|
||||
_omitNulls
|
||||
[ "className" .= catClassName
|
||||
[ "declawed" .= catDeclawed
|
||||
, "className" .= catClassName
|
||||
, "color" .= catColor
|
||||
, "declawed" .= catDeclawed
|
||||
]
|
||||
|
||||
|
||||
@@ -486,9 +486,9 @@ mkCat
|
||||
-> Cat
|
||||
mkCat catClassName =
|
||||
Cat
|
||||
{ catClassName
|
||||
{ catDeclawed = Nothing
|
||||
, catClassName
|
||||
, catColor = Nothing
|
||||
, catDeclawed = Nothing
|
||||
}
|
||||
|
||||
-- ** Category
|
||||
@@ -584,26 +584,26 @@ mkClient =
|
||||
-- ** Dog
|
||||
-- | Dog
|
||||
data Dog = Dog
|
||||
{ dogClassName :: !(Text) -- ^ /Required/ "className"
|
||||
{ dogBreed :: !(Maybe Text) -- ^ "breed"
|
||||
, 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 .: "className")
|
||||
<$> (o .:? "breed")
|
||||
<*> (o .: "className")
|
||||
<*> (o .:? "color")
|
||||
<*> (o .:? "breed")
|
||||
|
||||
-- | ToJSON Dog
|
||||
instance A.ToJSON Dog where
|
||||
toJSON Dog {..} =
|
||||
_omitNulls
|
||||
[ "className" .= dogClassName
|
||||
[ "breed" .= dogBreed
|
||||
, "className" .= dogClassName
|
||||
, "color" .= dogColor
|
||||
, "breed" .= dogBreed
|
||||
]
|
||||
|
||||
|
||||
@@ -613,9 +613,9 @@ mkDog
|
||||
-> Dog
|
||||
mkDog dogClassName =
|
||||
Dog
|
||||
{ dogClassName
|
||||
{ dogBreed = Nothing
|
||||
, dogClassName
|
||||
, dogColor = Nothing
|
||||
, dogBreed = Nothing
|
||||
}
|
||||
|
||||
-- ** EnumArrays
|
||||
@@ -1830,3 +1830,4 @@ instance AuthMethod AuthOAuthPetstoreAuth where
|
||||
& L.over rAuthTypesL (P.filter (/= P.typeOf a))
|
||||
else req
|
||||
|
||||
|
||||
|
||||
@@ -156,6 +156,11 @@ 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
|
||||
@@ -166,11 +171,6 @@ 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,6 +207,11 @@ 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
|
||||
@@ -217,11 +222,6 @@ 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 -- catClassName :: Text
|
||||
<$> arbitrary -- catDeclawed :: Maybe Bool
|
||||
<*> 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 -- dogClassName :: Text
|
||||
<$> arbitrary -- dogBreed :: Maybe Text
|
||||
<*> arbitrary -- dogClassName :: Text
|
||||
<*> arbitrary -- dogColor :: Maybe Text
|
||||
<*> arbitrary -- dogBreed :: Maybe Text
|
||||
|
||||
instance Arbitrary EnumArrays where
|
||||
arbitrary =
|
||||
|
||||
Reference in New Issue
Block a user