Merge remote-tracking branch 'origin/master' into 4.2.x

This commit is contained in:
William Cheng
2019-10-04 15:02:58 +08:00
1246 changed files with 29609 additions and 16734 deletions

View File

@@ -66,6 +66,7 @@ These options allow some customization of the code generation process.
| configType | Set the name of the type used for configuration | | OpenAPIPetstoreConfig |
| dateFormat | format string used to parse/render a date | %Y-%m-%d | %Y-%m-%d |
| dateTimeFormat | format string used to parse/render a datetime. (Defaults to [formatISO8601Millis][1] when not provided) | | |
| dateTimeParseFormat | overrides the format string used to parse a datetime | | |
| generateEnums | Generate specific datatypes for OpenAPI enums | true | true |
| generateFormUrlEncodedInstances | Generate FromForm/ToForm instances for models used by x-www-form-urlencoded operations (model fields must be primitive types) | true | true |
| generateLenses | Generate Lens optics for Models | true | true |

View File

@@ -23,7 +23,7 @@ Module : OpenAPIPetstore.Core
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -fno-warn-name-shadowing -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-name-shadowing -fno-warn-unused-binds -fno-warn-unused-imports #-}
module OpenAPIPetstore.Core where

View File

@@ -1075,6 +1075,7 @@ data FormatTest = FormatTest
, formatTestDateTime :: !(Maybe DateTime) -- ^ "dateTime"
, formatTestUuid :: !(Maybe Text) -- ^ "uuid"
, formatTestPassword :: !(Text) -- ^ /Required/ "password"
, formatTestBigDecimal :: !(Maybe Double) -- ^ "BigDecimal"
} deriving (P.Show, P.Eq, P.Typeable)
-- | FromJSON FormatTest
@@ -1094,6 +1095,7 @@ instance A.FromJSON FormatTest where
<*> (o .:? "dateTime")
<*> (o .:? "uuid")
<*> (o .: "password")
<*> (o .:? "BigDecimal")
-- | ToJSON FormatTest
instance A.ToJSON FormatTest where
@@ -1112,6 +1114,7 @@ instance A.ToJSON FormatTest where
, "dateTime" .= formatTestDateTime
, "uuid" .= formatTestUuid
, "password" .= formatTestPassword
, "BigDecimal" .= formatTestBigDecimal
]
@@ -1137,6 +1140,7 @@ mkFormatTest formatTestNumber formatTestByte formatTestDate formatTestPassword =
, formatTestDateTime = Nothing
, formatTestUuid = Nothing
, formatTestPassword
, formatTestBigDecimal = Nothing
}
-- ** HasOnlyReadOnly

View File

@@ -487,6 +487,11 @@ formatTestPasswordL :: Lens_' FormatTest (Text)
formatTestPasswordL f FormatTest{..} = (\formatTestPassword -> FormatTest { formatTestPassword, ..} ) <$> f formatTestPassword
{-# INLINE formatTestPasswordL #-}
-- | 'formatTestBigDecimal' Lens
formatTestBigDecimalL :: Lens_' FormatTest (Maybe Double)
formatTestBigDecimalL f FormatTest{..} = (\formatTestBigDecimal -> FormatTest { formatTestBigDecimal, ..} ) <$> f formatTestBigDecimal
{-# INLINE formatTestBigDecimalL #-}
-- * HasOnlyReadOnly

View File

@@ -1491,6 +1491,9 @@ components:
maxLength: 64
minLength: 10
type: string
BigDecimal:
format: number
type: string
required:
- byte
- date

View File

@@ -354,6 +354,7 @@ genFormatTest n =
<*> arbitraryReducedMaybe n -- formatTestDateTime :: Maybe DateTime
<*> arbitraryReducedMaybe n -- formatTestUuid :: Maybe Text
<*> arbitrary -- formatTestPassword :: Text
<*> arbitraryReducedMaybe n -- formatTestBigDecimal :: Maybe Double
instance Arbitrary HasOnlyReadOnly where
arbitrary = sized genHasOnlyReadOnly