threadheap / serverless-ide-vscode

Serverless IDE: Enhanced support for AWS SAM and CloudFormation in VS Code
https://serverless-ide.com/
195 stars 45 forks source link

[serverless framework] httpApi does not support method: '*' #110

Closed bdo closed 3 years ago

bdo commented 3 years ago

This tool incorrectly classifies '*' as an invalid value for the httpApi method property.

Using this following fragment in serverless.yml:

functions:
  api:
    handler: myhandler
    events:
      - httpApi:
          method: '*'
          path: /

The plugin highlights '*' as invalid and displays the following error: image

No error highlighting as '*' is a valid value for the httpApi method.

Using any as recommended by the plugin does not work and will lead to the following serverless validation error:

Serverless: Configuration warning at 'functions.api.events[0].httpApi.method': value 'any' does not satisfy pattern /^(?:\*|GET|POST|PUT|PATCH|OPTIONS|HEAD|DELETE)$/i

This means the only valid values for the serverless framework httpApi method are (case insensitive):

pavelvlasov commented 3 years ago

Thanks for reporting @bdo! The fix is effective in the latest version of the plugin.

bdo commented 3 years ago

Hi @pavelvlasov,

Thanks for replying so quickly to my issue !

However I tried again with version 0.5.26 and it's still not fixed.

By looking at your commit, I believe your fix applies to http not httpApi.

Please re-open including my related PR which fixes the httpApi schema.

pavelvlasov commented 3 years ago

thanks for pointing this out @bdo 👍 I updated httpAri definitions as well in the latest version.