Skip to content
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

Extending configuration validation for http events #8458

Closed
DianaIonita opened this issue Oct 30, 2020 · 1 comment · Fixed by #8471
Closed

Extending configuration validation for http events #8458

DianaIonita opened this issue Oct 30, 2020 · 1 comment · Fixed by #8471

Comments

@DianaIonita
Copy link

Use case description

As a plugin creator
I want to be able to add configuration validation to the http event that my plugin extends
So that a plugin user is informed in case they misconfigure it

What I have tried

If my plugin has a configuration like this:

myFunction:
  events:
    - http:
        method: get
        myCustomProperty:
          customSetting: aValue

I have tried to define it like this, but it seems that this overrides the whole http event validation:

const schema = {
    type: 'object',
    properties: {
      myCustomProperty: {
        type: 'object',
        properties: {
          customSetting: { type: 'string' }
        }
      }
    }
  }

serverless.configSchemaHandler.defineFunctionEvent('aws', 'http', schema);

Proposed solution

For instance, the framework could offer a method that extends validation for a given type of event:

serverless.configSchemaHandler.extendFunctionEvent('aws', 'http', schema);
@medikoo
Copy link
Contributor

medikoo commented Oct 30, 2020

@DianaIonita great thanks for that request. We're definitely open for PR that brings that in!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants