
AWS AppSync は包括的なコンテキストオブジェクトのモックによりリゾルバのテストを強化します
本記事は、2025 年 2 月 12 日にAWS公式サイトの What’s New with AWS? に掲載された英語記事を自動翻訳したものです。
ニュース内容
顧客がスケーラブルな API を構築するのに役立つフルマネージド GraphQL サービスである AWS AppSync は、EvaluateCode および EvaluateMappingTemplate API の改善を発表しました。この更新により、開発者はリゾルバーと関数のユニットテスト中に、アイデンティティ情報、スタッシュ変数、エラー処理など、コンテキストオブジェクトのすべてのプロパティを包括的にモックできます。また、この拡張機能では、明確で実用的なエラーメッセージによる JSON 入力検証が改善され、開発者がコンテキスト設定の問題を特定して修正しやすくなります。
これらの改善により、セットアップと構成の要件が簡素化されます。開発者は、テスト環境でリゾルバースタッシュ (ctx.stash) とエラー追跡 (ctx.outErrors) にアクセスして検証することで、関数とリゾルバーを効率的にテストできるようになりました。また、この更新により、開発者が ctx.identity に関連する呼び出し元情報のみを含めることができるため、アイデンティティのモックが簡素化されます。更新されたコンソールエクスペリエンスにより、リゾルバーのテスト結果の可視性が向上し、開発者はリゾルバーの実装をより効果的にトラブルシューティングして最適化できるようになります。
この機能強化は、AWS AppSync が現在サポートされているすべての AWS リージョンでご利用いただけます。
これらの新機能の詳細については、AWS AppSync のドキュメントにアクセスし、コンテキスト オブジェクト リファレンスを参照してください。また、AWS AppSync 開発者ガイドで例やベスト プラクティスを確認したり、AWS AppSync コンソールにアクセスして開始したりすることもできます。
原文
AWS AppSync, a fully managed GraphQL service that helps customers build scalable APIs, announces improvements to its EvaluateCode and EvaluateMappingTemplate APIs. This update enables developers to comprehensively mock all properties of the context object during resolver and function unit testing, including identity information, stash variables, and error handling. The enhancement also introduces improved JSON input validation with clear, actionable error messages, making it easier for developers to identify and fix issues in their context setup.
These improvements simplify the setup and configuration requirements. Developers can now efficiently test functions and resolvers by accessing and validating resolver stash (ctx.stash) and error tracking (ctx.outErrors) in their test environments. The update also simplifies identity mocking by allowing developers to include only the relevant caller information in ctx.identity. The updated console experience provides better visibility into the resolver test results, helping developers troubleshoot and optimize their resolver implementations more effectively.
This enhancement is available in all AWS Regions where AWS AppSync is currently supported.
To learn more about these new features, visit the AWS AppSync documentation and explore the context object reference. You can also explore examples and best practices in the AWS AppSync Developer Guide or get started by visiting the AWS AppSync console.
引用元:AWS AppSync enhances resolver testing with comprehensive context object mocking