on develop help sign in
Adding JSONValue support for 'any' types
cff18f5Brendan Hay
gen/src/Gen/AST/Solve.hs+1
@@ -137,6 +137,7 @@ getDerive g = loc "getDerive" g $ memo derived g go
137 Alt _ -> DRead : base
137 Alt _ -> DRead : base
138 Key -> DRead : base
138 Key -> DRead : base
139 OAuthToken -> DRead : base
139 OAuthToken -> DRead : base
140+ JSONValue -> DRead : base
140 -- FIXME: Add numeric cases
141 -- FIXME: Add numeric cases
141 _ -> [DRead, DNum, DIntegral, DReal] <> enum
142 _ -> [DRead, DNum, DIntegral, DReal] <> enum
142
143
gen/src/Gen/Syntax.hs+2
@@ -461,6 +461,7 @@ externalLit = \case
461 Key -> TyCon "AuthKey"
461 Key -> TyCon "AuthKey"
462 OAuthToken -> TyCon "OAuthToken"
462 OAuthToken -> TyCon "OAuthToken"
463 Body -> TyCon "Stream"
463 Body -> TyCon "Stream"
464+ JSONValue -> TyCon "JSONValue"
464
465
465internalLit :: Lit -> Type
466internalLit :: Lit -> Type
466internalLit = \case
467internalLit = \case
@@ -482,6 +483,7 @@ internalLit = \case
482 Key -> TyCon "AuthKey"
483 Key -> TyCon "AuthKey"
483 OAuthToken -> TyCon "OAuthToken"
484 OAuthToken -> TyCon "OAuthToken"
484 Body -> TyCon "Stream"
485 Body -> TyCon "Stream"
486+ JSONValue -> TyCon "JSONValue"
485
487
486mapping :: TType -> Exp -> Exp
488mapping :: TType -> Exp -> Exp
487mapping t e = infixE e "." (go t)
489mapping t e = infixE e "." (go t)
gen/src/Gen/Types.hs+2−1
@@ -332,7 +332,8 @@ initial s = Memo s mempty mempty res core mempty mempty mempty
332
332
333 -- Types available in Network.Google.Prelude.
333 -- Types available in Network.Google.Prelude.
334 core = Map.fromList
334 core = Map.fromList
335+ [ ("Body", SLit requiredInfo Body)
335− [ ("Body", SLit requiredInfo Body)
336+ , ("JSONValue", SLit requiredInfo JSONValue)
336 ]
337 ]
337
338
338makeLenses ''Memo
339makeLenses ''Memo
gen/src/Gen/Types/Schema.hs+1
@@ -201,6 +201,7 @@ data Lit
201 | DateTime
201 | DateTime
202 -- Core types.
202 -- Core types.
203 | Body
203 | Body
204+ | JSONValue
204 | Alt Text
205 | Alt Text
205 | Key
206 | Key
206 | OAuthToken
207 | OAuthToken