aheissenberger / serverless-appsync-offline

Serverless AWS AppSync Offline Plugin - Allow to run AppSync locally for serverless framework
MIT License
90 stars 25 forks source link

Incorrect string equality in templates #38

Closed cyberwombat closed 5 years ago

cyberwombat commented 5 years ago

I am wanting to compare strings and am unable to. Consider this example:

#set($foo = "a")
#set($bar = "a")

#if($foo == $bar) // Not the same
#if($foo == $bar.toString()) // The same
#if($foo.toString() == $bar) // The same

If I cast a single one then it matches?

I tried using the current version of velocityjs which appears to be the rendering engine and it works fine. Also someone tried it live on AWS and it works - just not when running locally.

My setup:

"serverless": "^1.47.0",
"serverless-appsync-offline": "^1.3.3",
"serverless-appsync-plugin": "^1.1.2",
"serverless-dynamodb-local": "^0.2.38",

My template:

#set($foo="a")
#set($bar="a")
#if($foo==$bar)
  same
#else
 not same
#end

I am loading this using SLS_DEBUG=* NODE_DEBUG=appsync-* yarn sls appsync-offline start and testing with graphiQL

aheissenberger commented 5 years ago

Hi @cyberwombat - this lib is a wrapper for appsync-emulator-serverless maybe not all features are supported - please rise an issue there to get a proper answer.