typescript
typescript copied to clipboard
Support for additional properties defined by Serverless plugin
Original intent : add the serverless-step-functions
plugin definition in https://github.com/serverless/typescript/pull/39
In order to implement definitions from https://github.com/serverless-operations/serverless-step-functions plugin within this package, one way could simply be to add dependency to this specific plugin in https://github.com/serverless/typescript/blob/b9825f6a5d5c2923282043ff3647ad4bdeb83afc/serverless.yml#L6-L7
One downside of such implementation is the lack of constraint for this plugin to be referenced in your serverless.yml
before being able to leverage definitions specifics to the plugin. Do you have any idea to enforce such behavior ?
✅ Validation with correct types
const serviceFile: AWS = {
service: 'my-app'
plugins: ['serverless-step-functions']
// It's ok to write those properties as the plugin is referenced above
stepFunctions: {
stateMachines: //...
}
❌ Validation with incorrect types
const serviceFile: AWS = {
service: 'my-app'
plugins: ['another-plugin']
// Should not allow those properties, as serverless-step-functions is not referenced in plugins property
stepFunctions: {
stateMachines: //...
}
For me it's a deal breaker that serverless.ts doesn't allow for custom definitions from plugins. In my case, I need to use the warmup
proprerty in the function level (from serverless-warmup-plugin)
But I'll keep one eye on this. Using code instead of yaml it's a great proposition!
same issue for me with warmup plugin.