Is it possible to use AppSync and GraphQL without mapping templates? Because Serverless has a limit of 200 resources and every mapping template is new resource.
Thank you!
The problem was that I was using serverless-appsync-plugin which didn't permit me to use the same GraphQL instance in multiple serverless projects.
I removed the plugin and referenced the API in different projects like this:
CreateUserDataSource:
Type: AWS::AppSync::DataSource
Properties:
ApiId: { 'Fn::ImportValue': 'graphQLApiId-${self:provider.stage}' }
Name: CreateUser
Type: AWS_LAMBDA
LambdaConfig:
LambdaFunctionArn: {'Fn::GetAtt': [CreateUserLambdaFunction, Arn]}
ServiceRoleArn: { 'Fn::ImportValue': 'appSyncServiceRole-${self:provider.stage}' }
CreateUserResolver:
Type: AWS::AppSync::Resolver
Properties:
ApiId: { 'Fn::ImportValue': 'graphQLApiId-${self:provider.stage}' }
DataSourceName: CreateUser
FieldName: createUser
TypeName: Mutation
RequestMappingTemplate: "{
\"version\": \"2017-02-28\",
\"operation\": \"Invoke\",
\"payload\": {
\"field\": \"createUser\",
\"arguments\": $utils.toJson($context.arguments),
\"handle\": $utils.toJson($context.identity)
}
}"
ResponseMappingTemplate: $util.toJson($context.result)