on develop help sign in
Adding support for FieldMask
commitd76255a4fa769ab8f09edaa3c308514ce235f4b2 authorBrendan Hay <brendan.g.hay@gmail.com> dateMon 20 Jun 2016, 10:15 (10 years ago) parentbf58ba1
3 files changed+19−14
gen/src/Gen/Syntax.hs+2 gen/src/Gen/Types/Map.hs−1 gen/src/Gen/Types/Schema.hs+17−13
gen/src/Gen/Syntax.hs+2
@@ -575,6 +575,7 @@ externalLit = \case
575575 RqBody -> TyCon "RequestBody"
576576 RsBody -> TyCon "Stream"
577577 JSONValue -> TyCon "JSONValue"
578+ FieldMask -> TyCon "FieldMask"
578579
579580internalLit :: Lit -> Type
580581internalLit = \case
@@ -595,6 +596,7 @@ internalLit = \case
595596 RqBody -> TyCon "RequestBody"
596597 RsBody -> TyCon "Stream"
597598 JSONValue -> TyCon "JSONValue"
599+ FieldMask -> TyCon "FieldMask"
598600
599601mapping :: TType -> Exp -> Exp
600602mapping t e = infixE e "." (go t)
gen/src/Gen/Types/Map.hs−1
@@ -14,7 +14,6 @@ import Control.Lens
1414import Data.Hashable
1515import qualified Data.HashMap.Strict as Map
1616import Data.Maybe
17−import Data.Text (Text)
1817
1918type Map = Map.HashMap
2019
gen/src/Gen/Types/Schema.hs+17−13
@@ -198,6 +198,8 @@ data Lit
198198 | Time
199199 | Date
200200 | DateTime
201+ | FieldMask
202+
201203 -- Core types.
202204 | RqBody
203205 | RsBody
@@ -210,21 +212,23 @@ instance FromJSON Lit where
210212 t <- o .: "format" <|> o .: "type"
211213 case t of
212214 -- Types
213− "string" -> pure Text
214− "boolean" -> pure Bool
215+ "string" -> pure Text
216+ "boolean" -> pure Bool
215217
216218 -- Formats
217− "float" -> pure Float
218− "double" -> pure Double
219− "byte" -> pure Byte
220− "uint32" -> pure UInt32
221− "uint64" -> pure UInt64
222− "int32" -> pure Int32
223− "int64" -> pure Int64
224− "time" -> pure Time
225− "date" -> pure Date
226− "google-datetime" -> pure DateTime
227− "date-time" -> pure DateTime
219+ "float" -> pure Float
220+ "double" -> pure Double
221+ "byte" -> pure Byte
222+ "uint32" -> pure UInt32
223+ "uint64" -> pure UInt64
224+ "int32" -> pure Int32
225+ "int64" -> pure Int64
226+ "time" -> pure Time
227+ "date" -> pure Date
228+ "date-time" -> pure DateTime
229+
230+ "google-datetime" -> pure DateTime
231+ "google-fieldmask" -> pure FieldMask
228232
229233 _ -> fail $
230234 "Unable to parse Literal from: " ++ Text.unpack t