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
WIP: Get request templates working #4
Conversation
Awesome |
@gertjvr I've added really basic support for the lambda integration and VTL templates. It just uses the default templates it doesn't currently support templates set by users. What do you think of adding partial support now until #2554 can be looked at? |
Will have a look tonight, see if we can merge these changes. Thank you for working on this. |
No worries. I need to add some more unit tests to cover the changes I made today. But it would be great if you could take a look at the changes as they are now. P.S. I noticed there's some whitespace changes. Not sure how that's happened but if you add |
if (context.integration === 'lambda') { | ||
context.requestTemplate = velocityDefaults.JSON_REQUEST_TEMPLATE | ||
context.responseMappings = velocityDefaults.RESPONSE_STATUS_CODES | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondering if this can be pushed into the lambda integration
as we are just picking these values of the context in the request and response integration methods.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I placed it there as once it is possible to get the configuration from the function object this is where it would be configured.
But I am happy to move it into lambda.js
if you would prefer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense now.
Closing in favour of #19 |
What did you implement:
Closes #3
How did you implement it:
I have added helpers for velocity templates in
./lib/integration/velocity
. These helpers create the context and render the velocity templates.The lambda integration executes the velocity template on the request and maps the response based on the error.
This is currently using the default templates. Accessing the config should be easier once serverless/serverless#2510 is merged
How can we verify it:
cd examples && npm start
Todos:
Is this ready for review?: NO