-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Closed
Labels
@aws-cdk/aws-appsyncRelated to AWS AppSyncRelated to AWS AppSynceffort/mediumMedium work item – several days of effortMedium work item – several days of effortfeature-requestA feature should be added or improved.A feature should be added or improved.p2
Description
Describe the feature
Based on this RFC, it would nice to explore what a CDK supported candidate would look like.
Use Case
I'd like the experimental L2 construct to support the JS runtime for AppSync resolvers
Proposed Solution
the datasource.createResolver() method should accept a code argument, a specified runtime, and make the mappingTemplates optional.
From this:
const appsyncFunction = new appsync.AppsyncFunction(this, 'function', {
name: 'appsync_function',
api,
dataSource: api.addNoneDataSource('none'),
requestMappingTemplate: appsync.MappingTemplate.fromFile('request.vtl'),
responseMappingTemplate: appsync.MappingTemplate.fromFile('response.vtl'),
});
const pipelineResolver = new appsync.Resolver(this, 'pipeline', {
api,
dataSource: api.addNoneDataSource('none'),
typeName: 'Query',
fieldName: 'getDemos',
requestMappingTemplate: appsync.MappingTemplate.fromFile('beforeRequest.vtl'),
pipelineConfig: [appsyncFunction],
responseMappingTemplate: appsync.MappingTemplate.fromFile('afterResponse.vtl'),
});To this:
const appsyncFunction = new appsync.AppsyncFunction(this, 'function', {
name: 'appsync_function',
api,
dataSource: api.addNoneDataSource('none'),
runtime: appsync.Runtime.APPSYNC_JS,
code: appsync.Code.fromAsset(path.join(__dirname, 'fn1.js'))
});
const pipelineResolver = new appsync.Resolver(this, 'pipeline', {
api,
dataSource: api.addNoneDataSource('none'),
typeName: 'Query',
fieldName: 'getDemos',
code: appsync.Code.fromAsset(path.join(__dirname, 'pipelineMappings.js'))
pipelineConfig: [appsyncFunction],
});Other Information
No response
Acknowledgements
- I may be able to implement this feature request
- This feature might incur a breaking change
CDK version used
2.50.0
Environment details (OS name and version, etc.)
macOS
fab-mindflow, piotrmoszkowicz, Oltier, icsaba, eikster-dk and 12 moreklauszhang, terrypireaux and borgoat
Metadata
Metadata
Assignees
Labels
@aws-cdk/aws-appsyncRelated to AWS AppSyncRelated to AWS AppSynceffort/mediumMedium work item – several days of effortMedium work item – several days of effortfeature-requestA feature should be added or improved.A feature should be added or improved.p2