My backend resturns json using the media type hal+json(rest api). The problem here is that velocity resolver of AWS AppSync returns:
Lexical error, Encountered: \"_\" (95), after:\".\" at unset[line 8, column 28]"
Because the media type node starts with a underscore, example:
{
"_embedded":{
"vehicle-assemblers":[...]
}
}
I believe the engine that AppSync uses is complaining about a variable starting with underscore.
"Configure the request mapping template" (AWS Edit Resolver)
## Raise a GraphQL field error in case of a datasource
#if($ctx.error)
$util.error($ctx.error.message, $ctx.error.type)
#end
## If the response is not 200 then return an error.
#if($ctx.result.statusCode == 200)
#set($response = $util.parseJson($ctx.result.body))
$util.toJson($response._embedded.vehicle-assemblers) ##line 8
#else
$utils.appendError($ctx.result.body, $ctx.result.statusCode)
#end
Has anyone any idea how to solve this problem?