aws-sam-cli
aws-sam-cli copied to clipboard
Feature request: Resolve AWS::Include transform intrinsic for DefinitionBody in validate
Description:
Error: Auth works only with inline Swagger specified in 'DefinitionBody' property.
It seems that this has already been discussed in 2021, but it is still appearing the the latest SAM.
sam validate
treats Auth and DefinitionUri as invalid for resource AWS::Serverless::Api.
Has this issue been solved or is it still ongoing? Seems like there were patches in place to address this.
Steps to reproduce:
This will throw an error:
ApiGatewayRestApiAnalitiqBackend:
Type: AWS::Serverless::Api
Properties:
StageName: Prod
Auth:
DefaultAuthorizer: CognitoAuthorizer
Authorizers:
CognitoAuthorizer:
UserPoolArn: !Ref CognitoUserPoolArn
IdentitySource: method.request.header.Authorization
DefinitionUri: 'api-slack.yaml'
This will not:
ApiGatewayRestApiAnalitiqBackend:
Type: AWS::Serverless::Api
Properties:
StageName: Prod
Auth:
DefaultAuthorizer: CognitoAuthorizer
Authorizers:
CognitoAuthorizer:
UserPoolArn: !Ref CognitoUserPoolArn
IdentitySource: method.request.header.Authorization
DefinitionBody:
'Fn::Transform':
Name: 'AWS::Include'
Parameters:
Location:
Observed result:
sam validate
warns:
"Auth works only with inline Swagger specified in 'DefinitionBody' property."
Expected result:
SAM should validate the template with API definition included as DefinitionUri as well as DefinitionBody. Especially if both refer to local file.
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
- OS: iOS Sonoma
-
sam --version
: 1.12.0 - AWS region: eu-central-1
# Paste the output of `sam --info` here
{
"version": "1.123.0",
"system": {
"python": "3.12.5",
"os": "macOS-14.6.1-arm64-arm-64bit"
},
"additional_dependencies": {
"docker_engine": "Not available",
"aws_cdk": "Not available",
"terraform": "Not available"
},
"available_beta_feature_env_vars": [
"SAM_CLI_BETA_FEATURES",
"SAM_CLI_BETA_BUILD_PERFORMANCE",
"SAM_CLI_BETA_TERRAFORM_SUPPORT",
"SAM_CLI_BETA_RUST_CARGO_LAMBDA"
]
}