Skip to content
This repository has been archived by the owner on Oct 17, 2024. It is now read-only.

feat(schema): serverless http api cors configuration #485

Conversation

konoui
Copy link
Contributor

@konoui konoui commented Aug 21, 2022

Issue #, if available:
#403

Description of changes:

Fix CorsConfiguration for AWS::Serverless::HttpApi,

  • AllowMethods/AllowHeaders/AllowOrigins properties are List instead of String.
  • allow-origin property is AllowOrigins not AllowOrigin
  • MaxAge property is Integer instead of String

Note: Current definition seems to be the same as CorsConfiguration for AWS::Serverless::Api but they are incorrect.

Ref:
HttpApiCorsConfiguration
https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-property-httpapi-httpapicorsconfiguration.html

Cors Configuration Object
https://github.com/aws/serverless-application-model/blob/master/versions/2016-10-31.md#cors-configuration-object

CorsConfiguration:
  AllowMethods: Optional. List containing the HTTP methods to allow for the HttpApi.  
  AllowHeaders: Optional. List of headers to allow. 
  AllowOrigins: Optional. List of origins to allow. 
  MaxAge: Optional. Integer containing the number of seconds to cache CORS Preflight request. 
  # For example, 600 will cache request for 600 seconds.
  AllowCredentials: Optional. Boolean indicating whether request is allowed to contain credentials.
  ExposeHeaders: Optional. List of allowed headers

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@rubenfonseca rubenfonseca changed the title fix(schema): serverless http api cors configuration feat(schema): serverless http api cors configuration Sep 2, 2022
@codecov-commenter
Copy link

Codecov Report

Merging #485 (aea501b) into master (83f2d49) will decrease coverage by 0.02%.
The diff coverage is n/a.

@@            Coverage Diff            @@
##           master    #485      +/-   ##
=========================================
- Coverage    6.34%   6.31%   -0.03%     
=========================================
  Files          30      30              
  Lines       15624   15613      -11     
=========================================
- Hits          991     986       -5     
+ Misses      14612   14606       -6     
  Partials       21      21              
Impacted Files Coverage Δ
cloudformation/intrinsics.go 46.93% <0.00%> (+0.07%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@rubenfonseca rubenfonseca force-pushed the fix-serverless-http-api-cors-configuration branch from aea501b to 370cd96 Compare September 2, 2022 09:42
@rubenfonseca rubenfonseca self-assigned this Sep 2, 2022
@rubenfonseca
Copy link
Contributor

Thank you very much for this! Updating the SAM schema is hard, and we really appreciate any kind of help. I'm merging and releasing a new minor version.

@rubenfonseca rubenfonseca merged commit a90bb03 into awslabs:master Sep 2, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Sep 2, 2022

🎉 This PR is included in version 6.9.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

3 participants