ãµã¼ãã¬ã¹ã§ GraphQL ãããã£ãã®ã§ AWS AppSync ã«å ¥éãã¦ã¿ããã¹ãã¼ããæ¸ãã¦ãã¼ã¿ã½ã¼ã¹ã¨ãªã¾ã«ãã追å ãã¦â¦â¦ã¨ããããã¼ã§ããã¶ãããããã¨é²ããã ãã©ãã¿ã¤ãã«ã«æ¸ããã¨ããæå»ãã¨ããã¯ããªç§ã¨ãã¦æ±ããã¨ããã¨å°ã£ã¦ãã¾ã£ãã
ã¤ã¾ã以ä¸ã®ãããªã¹ãã¼ãã§ããã¼ã¿ã½ã¼ã¹ã«æ ¼ç´ãããã¨ããã¯ããªç§ï¼ä¾ãã° 1503932400000
ï¼ã JSON ã«ãã¦è¿ããã¨ããã¨:
type Entry { createdAt: Int! }
ãããªæãã®ã¨ã©ã¼ã«ãªã£ã¦ãã¾ã£ãã
{ "data": { "getEvent": { "createdAt": null } }, "errors": [ { "path": [ "getEvent", "createdAt" ], "locations": null, "message": "Can't serialize value (/getEvent/createdAt) : Expected type 'Int' but was 'Long'." } ] }
ãªãã»ã©ããã¨æã£ããã®ã® GraphQL ã« Long åã¯ãªãã調ã¹ã¦ã¿ãã¨ãæ°å¤ã 2147483648
以ä¸ã«ãªãã¨ãªã¾ã«ãã®å
é¨ã§ Long åã¨ãã¦æ±ãããããã«è¦ããã
ããã¯åã Int ã®ãã£ã¼ã«ãã«ãã¼ã«ã«ã®ãªã¾ã«ãï¼type ã None ã®ãã®ï¼ãã¢ã¿ããããrequest mapping template ã
{ "version": "2017-02-28", "payload": 2147483648 ## ã¾ã㯠2147483647 }
ã®ããã«ãã¦ç¢ºããããã¨ãã§ããã
ããªç§ãããããã¦ã¨ããã¯ç§ã«ããã°ãã®å¢çãè¶ããªãããã ãã©ããã£ãããªã®ã§ãããã風ã«è§£æ±ºãã¦ã¿ã:
createdAt
ãã£ã¼ã«ããå¼æ°ãåããæåååãè¿ãããã«ããã
type Entry { createdAt(format: String, timezone: String): String! }
ä¸è¨ createdAt
ãã£ã¼ã«ãã«ãã¼ã«ã«ã®ãªã¾ã«ããã¢ã¿ããããrequest mapping template ã以ä¸ã®ããã«ããã
#set($format = $util.defaultIfNull($ctx.args.format, "yyyy-MM-dd HH:mm:ss")) #set($timezone = $util.defaultIfNull($ctx.args.timezone, "+09:00")) { "version": "2017-02-28", "payload": "${util.time.epochMilliSecondsToFormatted($ctx.source.createdAtEpochMillis, $format, $timezone)}" }
ã¯ã©ã¤ã¢ã³ãå´ããã¯ãã¼ãºãããããã©ã¼ãããã§åãåãããåãåã£ãæååããã®ã¾ã¾è¡¨ç¤ºãããªã©ããã°ããã楽ããã§ããã
åè: Resolver Mapping Template Context Reference - AWS AppSync