AWS AppSync

2022/07/26 - AWS AppSync - 1 new api methods

Changes  Adds support for a new API to evaluate mapping templates with mock data, allowing you to remotely unit test your AppSync resolvers and functions.

EvaluateMappingTemplate (new) Link ΒΆ

Evaluates a given template and returns the response. The mapping template can be a request or response template.

Request templates take the incoming request after a GraphQL operation is parsed and convert it into a request configuration for the selected data source operation. Response templates interpret responses from the data source and map it to the shape of the GraphQL field output type.

Mapping templates are written in the Apache Velocity Template Language (VTL).

See also: AWS API Documentation

Request Syntax

client.evaluate_mapping_template(
    template='string',
    context='string'
)
type template:

string

param template:

[REQUIRED]

The mapping template; this can be a request or response template. A template is required for this action.

type context:

string

param context:

[REQUIRED]

The map that holds all of the contextual information for your resolver invocation. A context is required for this action.

rtype:

dict

returns:

Response Syntax

{
    'evaluationResult': 'string',
    'error': {
        'message': 'string'
    }
}

Response Structure

  • (dict) --

    • evaluationResult (string) --

      The mapping template; this can be a request or response template.

    • error (dict) --

      The ErrorDetail object.

      • message (string) --

        The error payload.