-
Notifications
You must be signed in to change notification settings - Fork 188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(resolvers): JavaScript resolvers #534
Conversation
bboure
commented
Nov 29, 2022
•
edited
Loading
edited
- Adds support for JS resolvers
- JS resolvers are now default
- PIPELINE resolvers are now defaults
- Removes support for default mapping templates and locations
- Removes support for named data sources in resolver definition
🎉 This PR is included in version 2.0.0-alpha.13 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Is there any difference on how to use substitutions? I don't see anything explicit and I want to try it. My guess would be that they can be used from the |
Reading the code I see there is no option for that. How could we add vars like substitutions? |
This is not supported (yet). An alternative would be to use global variables. const MY_VAR = "foo"; we could generate those and prepend them to all js files. in the resolver you could do (fake example) function request() {
return {
"operation": "foo",
"myVar": MY_VAR,
}
} ideas? |
Yes, it's more tricky. I was reviewing the code and saw how it was implemented with VTL. In a way is much more straight forward as it's al string based. By the way, your suggestion is to use the actual definition:
and inject them as:
I think that it should be something that it is easy to test at the same time. |
Not sure what other things we should consider but something like this?
We define:
and it's replaced for:
We can't use the same |
Was there an explanation for removing support for default mapping templates and locations? Can defaults be implemented in a different way or is it a case of not doing AppSync AWS's way? |
Yes, it's explained here More context: with JS resolvers, it can cause confusion and unexpected results. I thought it would be better if the developer has to be explicit about it. Another reason is that, when you look at the Serverless Framework, the is no default for the Lambda functions' In V2, I am trying to be more in line with SF's core behaviors. |
🎉 This PR is included in version 2.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |