typescript icon indicating copy to clipboard operation
typescript copied to clipboard

Support for additional properties defined by Serverless plugin

Open fredericbarthelet opened this issue 3 years ago • 2 comments

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: //...
}

fredericbarthelet avatar Apr 27 '21 08:04 fredericbarthelet

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!

rsilvr avatar Oct 23 '21 19:10 rsilvr

same issue for me with warmup plugin.

julbr avatar Jun 03 '22 18:06 julbr