hirochachacha / graphql-assert-transformer

MIT No Attribution
17 stars 4 forks source link

Getting a "Failed to parse String literal at velocity" when having multiple "." in condition (pattern) #3

Open dabeidl opened 3 years ago

dabeidl commented 3 years ago

Error: Failed to parse String literal at velocity...

GraphQLSchema: type User @model { id: ID! email: String! @assert(condition: ".matches(\"[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}\")")

In vtl, I get $ctx.args.input.email.matches("[a-z0-9.%+-]+@[a-z0-9$ctx.args.input.email.-]+\$ctx.args.input.email[a-z]{2,4}") instead of $ctx.args.input.email.matches("[a-z0-9.%+-]+@[a-z0-9.-]+\.email[a-z]{2,4}")

dabeidl commented 3 years ago

I managed to work around the problem by using \x{002E} instead of .